String contains a number?


#1

Hey, How to check if a String contains a number?


#2

Hi @UiMe,

you can check with regex as the following,

Regex.Match(yourInputString, “\d+(?:[.,]\d+)*”)


#3

@UiMe
You can find using the below condition.
it gives true if it contains any number otherwise false.
“Your String”.Any( function(x) char.IsDigit(x))

if you want to know what is the number in your string try the below condition.

String.Join(vblf,(From item In “Your String”.ToString
Where IsNumeric(item)
Select item))


#4

Hi @sarathi125,

Thanks. If I have something like this as String:
Moh, Ahm / 02.08.18 12:11

How can I get (02.08.18) which is actually a date and save it in variable?