Number of Segments in a String

Number of Segments in a String

Count the number of segments in a string, where a segment is defined to be a contiguous sequence of non-space characters

Latest Source Code:
Github: NumberOfSegmentsInAString.java


Output:

String : Hello, world , segments: 2
String :  , segments: 0
String : , , , ,        a, eaefa , segments: 6
String :     foo    bar , segments: 2
Author: Hrishikesh Mishra