+ 1
C# Extract string
I am trying to make a language. How would I make it so that if they type in something which is in between parenthesis and double quotations than it would print it. for example if they say ("hello") than my program would write hello.
11 Respuestas
+ 3
I am not sure if I understood your question correct.
Are you looking for this.
string source = "\"Hello World!\"";
string unquoted = source.Trim('"');
string str = "\"HelloWorld\"";
string result = str.replace("\"", string.Empty);
https://stackoverflow.com/questions/5169680/unquote-string-in-c-sharp
+ 2
Cool. Thank you so much
Did you see the language I started to create called J#
+ 2
Dangit I thought I made that name up. I did J because my name starts with j and # because I made it with C#
+ 1
Is the string you try to analyze user-input or machine-generated input ?
+ 1
Still do not get what your goal is.
Made some code
https://code.sololearn.com/co20havlo1nt
In my opnion this works
The only problem is it will remove all quotation marks and parenthesis.
Can you explain a bit more what the code needs to do ?
+ 1
@sneeze that is exactly what im looking for actually. Thanks! One more thing...is there any way that it will require them to say alert before they put the parenthesis, quotations, and string. Im looking for something like this...
lets say they put in
alert("hello")
then it will output
hello
but if they don't put alert before it then it wont do anything
+ 1
Well that is the birth of the syntax-error, language syntax and keywords.
You can require that all of your commands should start with a keyword. If a command does not start with the correct keyword.
You do nothing (like c++) or you give them a message "unrecognized command are you missing a reference" (C#)
+ 1
Super. Keep up the good work.
+ 1
Do you mean J# language. The abbility to use java together with .net framework ?
https://nl.wikipedia.org/wiki/J%E2%99%AF
0
No I’m trying to make an alert function so if they write something like (“Hello”) it will take the text out from the quotation and parenthesis and just print the text so it would say Hello
0
User input