How to test if string starts with "LD" or "ld"

Hi,

I’m retrieving a value from a data table and would like to check if the variable starts with either “LD” or “ld”. What is the best approach here?

Thanks!

BR/Mikko

1 Like

Try with contains function in IF condition.
Eg: DataTable Variable.Contains(“LD”) or DataTable Variable.Contains(“ID”)

1 Like

Try this in condition of If activity : Str.Startwith(“LD”) Or Str.Startwith(“id”)

1 Like

Try like this

_stringVarible.StartsWith(“LD”) or _stringVarible.StartsWith(“id”)

1 Like

Or try with
Regex.Match(yourstring,"^(LD|ld)").Success
in your if condition.

1 Like

Hi,

If you want to judge not only “LD” and “ld” but also “Ld” and “lD” as true, you can use the following sentence.

stringValue.ToUpper.StartsWith("LD")
or
System.Text.RegularExpressions.Regex.IsMatch(stringValue,"^LD",RegexOptions.IgnoreCase)

Regards,

1 Like

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