hazejean Posted August 17, 2003 Posted August 17, 2003 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 Quote
*Experts* mutant Posted August 17, 2003 *Experts* Posted August 17, 2003 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: Dim str As String = "COM:""Some text""" DIm strs() As String = str.Split("""") Quote
hazejean Posted August 17, 2003 Author Posted August 17, 2003 tried that...got error unhandled exception... illegal character in path. thanks Quote
*Experts* mutant Posted August 17, 2003 *Experts* Posted August 17, 2003 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. Quote
Leaders dynamic_sysop Posted August 17, 2003 Leaders Posted August 17, 2003 you could Split( Chr(34) ) though , eg: Dim str As String = "COM:""Some text""" Dim strs() As String = str.Split(Chr(34)) '/// Chr(34) being " Quote
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.