How to split at 4 consequent spaces?

studio

#1

I have a string say myString=“This is my string. Name Birthdate Place”. I want to split this string where there are 4 consequent spaces. I have used myString.split(" ") but this gives compiler error as split takes only one char. How do I do this as I want to split this string and store it in another string variables using substring.


#2

Hi @shrutika

You can force .Split to use a string by providing it like that:
yourString.Split({“ ”},StringSplitOptions.None)

See this topic for more reference.


#3

anyVariable = YourString.ToString.Split({" "},System.StringSplitOptions.None)

Note anyVatiable is array of string.


#4

Thank you Rashmi. This solved the issue


#5