Checking end of a String
843789Jan 29 2010 — edited Jan 29 2010I have a relatively simple question, but I've been looking since yesterday and can't find the answer to my question.
I'm writing a program that reads a sentence using a dialog box. Depending on the last character of the sentence, output another dialog box identifying the sentence as declarative ( ends with a period ), interrogative ( ends with a question mark ), exclamatory ( ends with an exclamation point ), or other.
I set the JOptionPane to create the dialog box and ask the user for their sentence input. Then, I will create another JOptionPane to grab that sentence and output whether it is declarative, interrogative, etc.....
What I'm unsure about is how do I read the end of String input to see what type of sentence it is? I figured once I was on the right path to checking the end of the string I would create an If statement to facilitate that check and output the result. Any guidance is appreciated. Thank you.