Android Question Help to remove caracters in a variable

Discussion in 'Android Questions' started by Nkalampika, May 30, 2019.

  1. Nkalampika

    Nkalampika Member Licensed User

    hello I want to remove special characters. and keep figures how to do it? example: private var = "123aaa45" as string
    I want to keep numbers
     
  2. MarkusR

    MarkusR Well-Known Member Licensed User

  3. Mahares

    Mahares Well Known Member Licensed User

    Code:
    Dim MyString As String ="123aaa45" 
        
    Log(Regex.Replace("[^0-9]",MyString,""))   'returns: 12345
     
    Nkalampika, Jorge M A and DonManfred like this.
  4. Nkalampika

    Nkalampika Member Licensed User

  5. Nkalampika

    Nkalampika Member Licensed User

    I have a varaible:
    x = "t 196.01"
    I want x to give
    x = "196.01" I want to keep the point
     
  6. Nkalampika

    Nkalampika Member Licensed User

  7. Mahares

    Mahares Well Known Member Licensed User

    In your example, voici le resultat:
    Code:
    Dim MyString As String ="t 196.01"
        
    Log(Regex.Replace("[^0-9.]",MyString,""))   'returns: 196.01
     
    Kope likes this.
  8. Nkalampika

    Nkalampika Member Licensed User

  9. Nkalampika

    Nkalampika Member Licensed User

    yes !! thanks merci !
     
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