I have 2 strings and i want to use the String.Split() Method on them, what i want to do if the string contained “Love You” is to ignore the space and save it in the Array as one Element However if it contained “Love” alone the save it normally
str1 = "I Love Her"
str2 = "I Love You Not"
'no problem with splitting the first string
Dim strsplit1() As String = str1.Split(New String() {" "}, StringSplitOptions.None)
For the second string..how can i ignore the space splitter and save “Love You” as one element?
note this is just an example, my mind telling me check the indexofLove+1 but how can i get the index of Love?!
You can use simple trick here.
Before splitting the string replace “Love You” with “Love_You”, and after splitting is done, scan received array and replace “Love_You” back to “Love you”.