+ 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.

10th Mar 2018, 7:59 PM
Someone Else
Someone Else - avatar
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
10th Mar 2018, 8:55 PM
sneeze
sneeze - avatar
+ 2
Cool. Thank you so much Did you see the language I started to create called J#
11th Mar 2018, 7:39 PM
Someone Else
Someone Else - avatar
+ 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#
11th Mar 2018, 7:53 PM
Someone Else
Someone Else - avatar
+ 1
Is the string you try to analyze user-input or machine-generated input ?
10th Mar 2018, 10:51 PM
sneeze
sneeze - avatar
+ 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 ?
10th Mar 2018, 11:11 PM
sneeze
sneeze - avatar
+ 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
11th Mar 2018, 3:24 PM
Someone Else
Someone Else - avatar
+ 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#)
11th Mar 2018, 7:39 PM
sneeze
sneeze - avatar
+ 1
Super. Keep up the good work.
11th Mar 2018, 7:42 PM
sneeze
sneeze - avatar
+ 1
Do you mean J# language. The abbility to use java together with .net framework ? https://nl.wikipedia.org/wiki/J%E2%99%AF
11th Mar 2018, 7:46 PM
sneeze
sneeze - avatar
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
10th Mar 2018, 10:49 PM
Someone Else
Someone Else - avatar
0
User input
10th Mar 2018, 10:51 PM
Someone Else
Someone Else - avatar