I need to separate information from a string

Hello everyone,

I need to separate information from a string, which is:

[APROVADO] - 300845 - ISRAEL DIAS DA SILVA

Output needs to be:

“Approved”

“300845”

“Israel Dias da Silva”

Hi,

There are some ways to achieve it.

String.Split

yourString.Split("-"c)(0).Trim({" "c,"["c,"]"c})

yourString.Split("-"c)(1).Trim

yourString.Split("-"c)(2).Trim

Regex

m=System.Text.RegularExpressions.Regex.Match(yourString,"\[(.*?)\] - (.*?) - (.*)")

then

m.Groups(1).Value
m.Groups(2).Value
m.Groups(3).Value

note: m is System.Text.RegularExpressions.Match type

Hope this helps you.

Regards,

Thank you so much, Perfect!

1 Like

Hey, @Yoichi , could you let me know what this “c” after the quotes means
("-"c)

Hi,

"x"c means Char type data. (not String but Char)

The following document help you.

Regards,

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.