想要从字符串“1,62099”的两边删除双引号?

时间:2022-09-15 13:15:30

If my string is "1,60299" getting collection of UserCodes .... then if I want to remove " from both ends what do I have to do ??

如果我的字符串是“1,60299”获取UserCodes的集合....那么如果我想从两端删除我该怎么办?

ex: strUserCode = "1,62099,100156321"

例如:strUserCode =“1,62099,100156321”

3 个解决方案

#1


0  

I would suggest you to use replace() function

我建议你使用replace()函数

Or you can use LTrim(), RTrim() functions

或者您可以使用LTrim(),RTrim()函数

if I understood you correctly that you are using vb.net

如果我理解你正在使用vb.net

#2


0  

Try to use the String.Replace(String, String) Method, it returns a new string in which all occurrences of a specified string in the current instance are replaced with another specified string.

尝试使用String.Replace(String,String)方法,它返回一个新字符串,其中当前实例中所有出现的指定字符串都被另一个指定的字符串替换。

String.Replace Method (String, String)

String.Replace方法(String,String)

Something like this -

像这样的东西 -

Dim errString As String = "Example String " & """" & "This is the String with double quotes." & """"

Console.WriteLine("The original string is:{0}'{1}'{0}", Environment.NewLine, errString)

' Correct the spelling of "document".  
Dim correctString As String = errString.Replace("""", "")

Console.WriteLine("After correcting the string, the result is:{0}'{1}'", Environment.NewLine, correctString)

#3


0  

How about strUserCode.Trim('"');

strUserCode.Trim('“')怎么样;

#1


0  

I would suggest you to use replace() function

我建议你使用replace()函数

Or you can use LTrim(), RTrim() functions

或者您可以使用LTrim(),RTrim()函数

if I understood you correctly that you are using vb.net

如果我理解你正在使用vb.net

#2


0  

Try to use the String.Replace(String, String) Method, it returns a new string in which all occurrences of a specified string in the current instance are replaced with another specified string.

尝试使用String.Replace(String,String)方法,它返回一个新字符串,其中当前实例中所有出现的指定字符串都被另一个指定的字符串替换。

String.Replace Method (String, String)

String.Replace方法(String,String)

Something like this -

像这样的东西 -

Dim errString As String = "Example String " & """" & "This is the String with double quotes." & """"

Console.WriteLine("The original string is:{0}'{1}'{0}", Environment.NewLine, errString)

' Correct the spelling of "document".  
Dim correctString As String = errString.Replace("""", "")

Console.WriteLine("After correcting the string, the result is:{0}'{1}'", Environment.NewLine, correctString)

#3


0  

How about strUserCode.Trim('"');

strUserCode.Trim('“')怎么样;