How to use split to realize string Segmentation in Java
In this issue, the editor will bring you about how to use split to achieve string segmentation in Java. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.
The function in Java to split strings is split.
Public String [] split (String regex,int limit), which splits the string with String regex. The return value is an array of strings.
String word = "Xiao Wang, Xiao Wei, Xiao Ming, Xiao Hong"; String [] words = word.split (","); / / Note here to receive System.out.println with string array (words [0] + "\ n" + words [1] + "\ n" + words [2] + "\ n" + words [3]) / / the output results are "Xiao Wang", "Xiao Wei", "Xiao Ming" and "Xiao Hong". The above is how to use split to achieve string segmentation in Java shared by Xiaobian. If you happen to have similar doubts, please refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.