I have a string that looks like this
Telephone number: 123-123-124
Service address:
1234 My Street
City, State
I need to extract the 3rd line and the city and state to separate variables. Does anyone know how to do this?
I have a string that looks like this
Telephone number: 123-123-124
Service address:
1234 My Street
City, State
I need to extract the 3rd line and the city and state to separate variables. Does anyone know how to do this?
Hi,
Hope the following helps you.
address = yourString.Split(vbCrLf.ToCharArray,StringSplitoptions.RemoveEmptyEntries)(2)
cityAndState = yourString.Split(vbCrLf.ToCharArray,StringSplitoptions.RemoveEmptyEntries)(3)
Regards,
Hi Jonathan,
If the string is as your example, then you’ll need to perform several splits:
yourString.Split( new String() {Environment.NewLine} , StringSplitOptions.None )
Best,
Pedro Arroyo