当我不想使用android的拆分功能时,我们如何在特定的字符串或字符上拆分给定的字符串,有没有其他可用的方法?
发布于 2014-01-17 00:22:19
发布于 2014-01-17 00:23:11
如果您不介意迭代的性质,StringTokenizer是一个很好的选择。
这里有一个相关的帖子:Android Split string
例如,从那篇文章中可以看到:
String myStr = "Fruit: they taste good";
StringTokenizer tokens = new StringTokenizer(myStr, ":");
String first = tokens.nextToken();// this will contain "Fruit"
String second = tokens.nextToken();// this will contain " they taste good"https://stackoverflow.com/questions/21167077
复制相似问题