jeudi 11 octobre 2018

how to get separate message dialog with string that contains "!" and string that doesn't

I'm making basic chatbot,

i have to create topics.. eg work, play, cars"

it will prompt user to tell me about those topics...

now if user inputs "i like cars"

it will respond "tell me more about cars"

however if user inputs "i like cars!" (exclamation mark the difference)

im not sure how to get it to respond "wow you feel strong about that"

i tried

if (topic.contains("!")) { topic = JOptionPane.showInputDialog("wow you feel strong about that")

any help in recognising "!" in user input for an if statement?

thank you kindly for your assistance

Aucun commentaire:

Enregistrer un commentaire