开发者

how to remove char (") from the begin and the end of a string?

how to rem开发者_JAVA技巧ove char (") from the begin and the end of a string ?

ex: "1234"567" ==> 1234"567

thank's in advance


myString = myString.Trim('"');

http://msdn.microsoft.com/en-us/library/d4tt83f9.aspx

Note that this will remove any amount of quotes at the beginning or the end of the string. If you only want to remove at most one from each end, see Anthony Pegram's answer. Or do it with regex:

myString = Regex.Replace(myString, "^\"|\"$", "");
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜