String Question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • yeshello54
    New Member
    • Mar 2009
    • 54

    #1

    String Question

    Hello all. So i have a question about searching strings. I have the following if statement...

    if (parser.get_tok en(i,2).at(0) =='#' && parser.get_toke n(i,2).at(1)==' 5'){
    ...
    ...
    ..
    }

    What I want to do is change where it says "=='5' " to be able to look for all numbers 0-9 instead of just 5. Any help would be awesome. Thanks.
  • gpraghuram
    Recognized Expert Top Contributor
    • Mar 2007
    • 1275

    #2
    Then u shuld change the condition like this

    Code:
    if (parser.get_token(i,2).at(0) =='#' && (parser.get_token(i,2).at(1)>='0' &&(parser.get_token(i,2).at(1)<='9' ){
    }
    raghu

    Comment

    • donbock
      Recognized Expert Top Contributor
      • Mar 2008
      • 2427

      #3
      or perhaps
      Code:
      #include <ctype.h>   ...   or <ctype> if this is C++
      if (parser.get_token(i,2).at(0) =='#' && isdigit(parser.get_token(i,2).at(1) ){
      }

      Comment

      • yeshello54
        New Member
        • Mar 2009
        • 54

        #4
        thanks guys for the help

        Comment

        Working...