I can check if a string contains an integer but unable to do for a alphabet?
Hey @ishankakar
Regex.Matches(yourstring,“[a-zA-Z]”).Count
Remember to use Regex class, you have to use namespace System.Text.RegularExpressions in your import
or one more way
bool result = hello.Any(function(x) NOT char.IsLetter(x))
For above you have to import System.LINQ namespaces in your project.
Regards…!!
AKsh
Hey @Bachali
If you want to just check a string is only alphabets and Numbers then you can use below Regex Patter,
Int Count = Regex.Matches(str,“[1]+$”).Count
By Linq -
B
ool IsAlphnumornot="Your String".All(function(c) Char.IsLetterOrDigit(c))
or if you want to check that any character is Alphanumeric or Digits/Number as well then can use below Linq
Bool IsAlphnumornot="Your String".Any(function(c) Char.IsLetterOrDigit(c))
Regards…!!
Aksh
a-zA-Z0-9 ↩︎
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.