java - How do I extract words from a string? -


i did research , find answers search results. trying extract word string , adding word string, replacing 1 removed. each situation different, can't make constant. i'd appreciate help!

package rudolph;  import javax.swing.joptionpane;  public class ifblankwasblank {     public static void main(string[] args) {         string charinput = "";         string thing = "";         string pun = "";          charinput = joptionpane.showinputdialog(null,                 "enter person or thing you'd make fun of:");         thing = joptionpane.showinputdialog(null,                 "enter thing " + charinput +" doing:");         pun = joptionpane.showinputdialog(null,                 "enter pun " + charinput + " doing:");          string msg = "if " + charinput + " " + thing + ", they'd " + pun + ".";           joptionpane.showmessagedialog(null, msg);     } } 

so if enter in rudolph red nosed reindeer in charinput string, energy efficient in thing string, , led in pun string, want msg "if rudolph red nosed reindeer energy efficient, they'd rudolph led nosed reindeer." know it's silly, i'd know how utilize if could! help!

you should use string split method.string#split()


Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -