B4J Question String.Contains searches with wild card mask.

Discussion in 'B4J Questions' started by Msteffes, Apr 16, 2019.

  1. Msteffes

    Msteffes New Member

    Brand new user of B4J so prepare for obvious questions/answer posts.

    Is it possible to do a string search with a wild card mask within the function String.Contains. Or is there a better option.
    I need to search strings similar to the following. "I see (10) dogs" but I want my function to ignore the (10); the number will vary from 0 to 255.
     
  2. sorex

    sorex Expert Licensed User

    you can use regex to find a match based on wildcards.

    Code:
    Dim m As Matcher
    m=
    Regex.Matcher("I see \d+ dogs","what do I see here? I see 10 dogs in my living room")
    If m.Find Then Log("string matched")
     
    Last edited: Apr 17, 2019
    DonManfred and Erel like this.
  3. MarkusR

    MarkusR Well-Known Member Licensed User

  4. Msteffes

    Msteffes New Member

    Thanks, you each get a Woof Woof Award.
    I am quite impressed at B4X depth of functionality. So much too learn.
     
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