Checking first 2 characters of a string

Hi UiPath,

Is there a way for us the check if the first 2 characters are letters?

Example:

AB123

Since the first 2 character of my example are letters it should return my check as TRUE.

Thanks in advance.

Alvin

Could you try this?

Not str_variable.Substring(0,2).IsNumeric

Kind Regards,
Ashwin A.K

Hi

Hope the below expression would help you resolve this

Use this condition in a IF activity

Not (Isnumeric(strinput.ToString.SubString(0,2))

If true it goes to then block

Cheers @Alvin_Apostol2

Hi,

Another solution:

System.Text.RegularExpressions.Regex.IsMatch(yourString,"^[A-Za-z]{2}")

Regards,

Hi @Alvin_Apostol2

Use If condition

Inputstring.Tostring.Contains(System.Text.RegularExpressions.regex.Match("InputString","^[A-Za-z]{2}"))

Regards
Gokul

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