str.split("\\s+")
would work. The +
at the end of the regular-expression, would treat multiple spaces the same as a single space. It returns an array of strings (String[]
) without any " "
results.
str.split("\\s+")
would work. The +
at the end of the regular-expression, would treat multiple spaces the same as a single space. It returns an array of strings (String[]
) without any " "
results.