Question help with string extraction

jc3828

New member
Joined
Nov 25, 2013
Messages
1
Programming Experience
5-10
I am trying to come up with a method to extract strings from a string field where the the text is "some txt" "some other text" "and more text"
can't use a delimiter, as space and right quote won't work. This is just a brain freeze now.
results something like
string1 = some txt
string2 = some other text
string3 = and more text
 
Are you saying that the initial text literally has three substrings that are each wrapped in double quotes with a space between each pair? If so then there are a number of options, some more elegant than others. You could simply use String.Split to split on each instance of a double quote followed by a space followed by another double quote, then use String.Trim to remove the extra double quotes from the first and last item. You could also split on the double quotes alone and then remove the items that contain just a space.
 
Back
Top