• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to use if statment

 
deepika deepi
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

i have an regular expression like this " sym : symbol : (\.|\,|\-)". Here name is symbol and regX is (\.|\,|\-)/(\.|\,|\-) should be equal to regX_hash else regX_hash should be equal to regX is (\.|\,|\-)

Using if case i would like to get an output like this
System.out.println("Result "+regX_hash);

OUTPUT: Result (\.|\,|\-)

if(name == "symbol") {

}else{

}


How to apply this and get the result. I am unable to reach the designation.
 
Puneet N Vyas
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
you are doing String comparison with == ?
 
deepika deepi
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Puneet N Vyas vyas,

i need an value comparison
 
Puneet N Vyas
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
use string builder and regex comparison method.
 
Campbell Ritchie
Sheriff
Pie
Posts: 49865
71
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should know about the equals() and equalsIgnoreCase() methods.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic