• Post Reply Bookmark Topic Watch Topic
  • New Topic

if/else expression logic  RSS feed

 
chavez james
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

I want to thank you for reviewing my post and any contributions you provide to the solutions to my problem. The program i am working on is to take string from the user which should be a phone number then it will return true or false based upon the method that checks to see if it meets the criteria of a certain format if does not it will return false otherwise return true. I am working on a if/else structure that will print this number is valid if it meets the criteria of the method i previously mentioned or return the number is not valid if it is false. I need some help regarding the logic of the expression i put in the parentheses of the if/else statement. This is what i have so far:




Do i need to compare it based upon the method that checks if it is true?
 
chavez james
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After researching i have to use the .equals method to compare still do not know the expression and do not have down the logic. someone please help.
 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Regex is what you need!

http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html
 
chavez james
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is what i have in my program, i have a method that does just that, i need to get an if/else that returns that the number is valid if true based up on the method or is not valid if it is false. I just cannot get the expression down to display that.
 
chavez james
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nvm i resolved my issue.
 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
chavez james wrote:Nvm i resolved my issue.

Then I suggest you mark the thread as "resolved".

Thanks

Winston
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!