help re extracting text from quoted sentence

hazejean

Regular
Joined
Jul 11, 2003
Messages
68
I have situation where i have statements as follows:
COM="this is text i want to extract"

I want to remove COM=" and " at right.
Can't do it with split function because " cannot be used as split delimiter.

Any ideas?

thanks
 
You can search for a quote using a double quote:
""
Double quote stands for a single quote when used in string.
So you can use it in split:
Visual Basic:
Dim str As String = "COM:""Some text"""
DIm strs() As String = str.Split("""")
 
You can also use the IndexOf method of the string object, and look for quotes. IndexOf returns the number of characters at which the string you are looking for starts. So you could have two of IndexOf calls that will look for a quote and then use SubString method to get the string from between the quotes.
 
Back
Top