Simcoder Posted December 16, 2005 Posted December 16, 2005 This probably has to be one of the most annoying yet simple problems I have ever ran across. How do I remove parenthesis from a string in code such as str1 = str2.Text.Replace(" '"' ", ""); That does not work because the parenthesis is a keychar. Thanks In Advance. -=Simcoder=- Quote Whatever thy hand findest to do, do it with all thy heart - Jesus
Cags Posted December 17, 2005 Posted December 17, 2005 As odd as it looks you can use this... str1 = str2.Replace(@"""", ""); Quote Anybody looking for a graduate programmer (Midlands, England)?
Wile Posted December 17, 2005 Posted December 17, 2005 Guessing it is C# (well, there is no ; in vb ;) ), you can also use the \ to indicate the use of the " character. So it would be something like: [CS] str1 = str2.Text.Replace(" \" ", ""); [/CS] The \ indicates an escape sequence allows you to specify other characters as well (like linefeed \n, return \r, tab \t, and some more stuff). Quote Nothing is as illusive as 'the last bug'.
Cags Posted December 17, 2005 Posted December 17, 2005 Its strange how the '"' actually has 2 escape characters, the example I gave also works. Quote Anybody looking for a graduate programmer (Midlands, England)?
Leaders snarfblam Posted December 17, 2005 Leaders Posted December 17, 2005 I was pretty confused until I realized that you guys were all talking about quotes (the thread's title is removing parentheses). Quote [sIGPIC]e[/sIGPIC]
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.