Quote:
Originally Posted by jingojang
Hi nikilgupta345, would you mind creating an example?
|
PHP Code:
String s = "This is a string";
String[] splitString = s.split();
// splitString = {"This", "is", "a", "string"}
String firstWord = splitString[0];
String lastWord = splitString[splitString.length - 1];
System.out.println("First word: " + firstWord + " Last word: " + lastWord);
__________________