java - Check if a string lies within a range -


i have 1 string has between specific range.

the range of values are: "620/75r38" - "1050/50r38" guys can see, should fit within range. yet don't know how put in java code can me? tried string.compareto() function somehow doesn't give right answeres.

edit

here i've tried.

private submaat = ""; private maat = "650/65r38"; if(maat.contains("r")){         submaat = maat.substring(0, maat.lastindexof("r"));     } else if (maat.contains("-")){         submaat = maat.substring(0, maat.lastindexof("-"));     }  if(submaat.compareto("620/75") >= 0 && submaat.compareto("1050/50") <= 0){    //do } 

try this

   string lower="620/75r38";    string upper= "1050/50r38";     string str="50/65r38";      if(str.compareto(lower)>0 && upper.compareto(str)<0){        system.out.println("inside range");    } 

Comments

Popular posts from this blog

design - Custom Styling Qt Quick Controls -

Unable to remove the www from url on https using .htaccess -