We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Java
- Strings
- Java String Tokens
- Discussions
Java String Tokens
Java String Tokens
Sort by
recency
|
1796 Discussions
|
Please Login in order to post a comment
It’s a good exercise for understanding how to break down a sentence into meaningful parts, especially by defining tokens as sequences of alphabetic characters only. Khelo24bat
If your test cases are failing due to edge cases:
s.trim().length == 0to check whether the string is empty. If it is, print 0 and return.s.trim().split()to remove any leading or trailing spaces before processing the string.import java.io.; import java.util.;
public class Solution {
}
import java.io.; import java.util.;
public class Solution {
}