I want to be able to extract all of the characters up until the first space in any type of sentence. How would I do this in Java?
String s1 = "This is a sentence that may vary in length and number of characters";
String s2 ="However, this time the first word is longer";
e = // Operation with s1 which results in "This"
e = // Same operation with s2 results in "However,"