Split by space

Dear all,

I need to split by " ", and get the first one. After that I need to join this first split with the whole string.

FR - BLABLA - 78 → Before FR there is a space that i want to delete.

HI @Angel_Llull

Can you share the sample input and expected output

Simple use trimstart to remove the space before FR

“FR - BLABLA - 78”.TrimStart

Refer SS
image

Regards
Gokul

Hello,

Try this:
“FR - BLABLA - 78”.TrimStart.Split(" "c)(0)

Hi @Angel_Llull ,

Correct me if I am wrong, but you wish to eliminate trailing spaces correct?
If that is the case, then simply use a Trim operation like so:
image

var.ToString.Trim

If you wanted the first two letters, then you can use this:
image

System.Text.RegularExpressions.Regex.Match(var.ToString,"\b[A-z]{2}\b(?=\s\-)").Value

Kind Regards,
Ashwin A.K

Thanks all!

I found the solution using myvar.TrimStart :slight_smile:

1 Like

Great!

We’d appreciate it if you marked the answer as solution so that others facing similar issues may benefit from it, and also so that we may close this thread.

Kind Regards,
Ashwin A.K

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