How can I split the following word in to an array
That's the code
into
array 0 That 1 s 2 the 3 code I tried something like this
String str = "That's the code"; String[] strs = str.split("\\'"); for (String sstr : strs) { System.out.println(sstr); } But the output is
That s the code
'.That's the codeis equivalent toThat is the code. I'm comparing sentence.That'sis two words:Thatand the contraction ofistos.What'stoWhat is. :)