B4J Question String contain NO NUMBERS characters

Discussion in 'B4J Questions' started by petr4ppc, Jan 29, 2015.

  1. petr4ppc

    petr4ppc Active Member Licensed User

    Dear friends, please,

    is here some simple soulution how to recognize not number characters in string?

    For example if he string is "1254as5748"
    Here si "as" inside the string....I can not use this string...

    I need use only string with numbers....

    Or the best solution is
    1) get length of string
    2) check each character if it is number = the character contain 1,2,3,4,5,6,7,8,9,0
    3) delete or use this string

    Thank you very much
    Best regards
    p4ppc
     
  2. rwblinn

    rwblinn Well-Known Member Licensed User

    Hi,

    use IsNumber, like
    Code:
    Dim s As String = "1254as5748"
    Log(s & " is a number " & IsNumber(s)) ' False
    Dim s As String = "12545748"
    Log(s & " is a number " & IsNumber(s)) ' True
     
  3. petr4ppc

    petr4ppc Active Member Licensed User

    Hi RWBLINN,

    thank you very much, 100% solution, perfect ;)

    Best regards
    p4ppc
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice