Condition for an integer to contain 10 digit numbers only


#1

what is the condition to get only 10 digits for mobile number . suppose if we are working with input dialog asking user to enter your mobile number then fro user it should accept only 10 digit mobile number if he send 9 or 11 then it should not proceed . what is the condition please tell me anyone.


#2

Hi Harsha

You will get the output from Input dailog as string or generic value ex:phonenumber

you can use the condition phonenumber.tostring.length = 10 then proceed else ask the user to enter number again.

if you want to validate the number only for digits use the following regular expression

System.text.regularexpression.regex.Ismatch(phonenumber,"[^0-9*$]")

find the attached workflow if you need further clarification

Input Dailog Example.xaml (13.3 KB)


#3

Hi,

This is good example but from my side i would simply stick to check only if this pattern is a match.

^\d{10}$

It will check if the input is exactly 10 digits.

Cheers