How to find whether the string values contains alphabets

Hi,

If we have string values, how to find whether it is containing alphabets or numbers.

Thanks and Regards,

If it is a character then you can use

Char.IsLetter(c) or Char.IsDigit(c)

if it is a word or sentence you can use regular expression.

It may contain single alphabet or word.

just a few options and samples:
grafik
with regex
grafik

Hi @Chippy_Kolot

Use the “Is Match” activity with the following regular expressions to check for alphabets and numbers:

  • To check if the string contains alphabets: Pattern: [a-zA-Z] Input: The string you want to check Result: The “Is Match” activity will return True if the string contains any alphabets.
  • To check if the string contains numbers: Pattern: [0-9] Input: The string you want to check Result: The “Is Match” activity will return True if the string contains any numbers.

Thanks!!

I am not fond of using Regexes for such small checks, it feels overkillish.
I prefer using Any() to check if ANY of the characters is a letter/number.
To search numbers, change “Char.IsLetter()” to “Char.IsDigit()”.
Feel free to change myString’s value to test the code samples.

VB
IsLetterCheck.xaml (6.9 KB)

C#
IsLetterCheck.xaml (8.0 KB)