• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

if/else expression logic

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nvm i resolved my issue.
 
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

chavez james wrote:Nvm i resolved my issue.


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

Thanks

Winston
 
Note to self: don't get into a fist fight with a cactus. Command this tiny ad to do it:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic