Skip to main content
Known Participant
Dec 1, 2022 12:45 PM UTC
Question

Check if given number is between 1 & 20 digits

Please help me check if the given number is between 1 & 20 digits and doesn't contain any alphabet in it.

Like we have like(fv!item,"[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]") to check the given number should be exactly 10 digits and no alphabets in it.

    2 replies

    harshitb6843
    Brainy
    Dec 1, 2022 1:11 PM UTC

    and(
      a!isNotNullOrEmpty(ri!number),
      len(ri!number) < 20,
      a!isNullOrEmpty(stripwith(ri!number,"0123456789"))
    )

    The first condition checks that it should not be less than 1 digit. 
    Second condition checks that it should not be more than 20 digits. 
    Third condition checks that it should only contain numbers. 

    karthikr067273
    Inspiring
    Dec 1, 2022 2:56 PM UTC

    Hi Shamima
    Maybe the following piece of code will work for you.

    and(a!isNotNullOrEmpty(fv!item), len(fv!item) <= 20, all(fn!like, char(code(fv!item)), "[0-9]"))