Split with Consecutive Spaces

Hi,

I tried the below. But it doesn’t work as the C must be a single character. So how do I split?

(System.Text.RegularExpressions.Regex.Match(Result,"(?<=Chr_D ).+").Value).ToString.Split({"\s{5}“C,”*"C})(2)

Thanks

Hi @Anonymous2

Try this stroutput.split("".ToCharArray)

Thanks
Ashwin.S

if you are looking to split the text with space - try this

strSpaceText.Split(New Char() {" "c})

Hi,

Hope the following helps you.

System.Text.RegularExpressions.Regex.Split((System.Text.RegularExpressions.Regex.Match(Result,"(?<=Chr_D ).+").Value),"[*\s]+")(2)

Regards,

@Anonymous2

String stroutput = “This is a sample string for testing purpose”

string Array strArrVariable = stroutput.split(" ".ToCharArray)

Now, you can refer or fetch any number of words with the following way:-

  1. strArrVariable(0) -> This
  2. strArrVariable(1) -> is
  3. strArrVariable(2) -> a
  4. strArrVariable(3) -> sample
  5. strArrVariable(4) -> string
    etc etc etc

Mark as Solution if you got your answer…

Thanks and Regards,
@hacky