This article mainly introduces the method of converting string to String array in java, involving the traversal, segmentation, conversion and other related operation skills of java string. Friends in need can refer to the following
The examples of this article are described Java implements the method of converting string to String array. Share it with everyone for your reference, the details are as follows:
package Tsets; import java.util.Arrays; import java.util.List; public class String2StringList { public static List<String> stringToList(String str){ return Arrays.asList(str.split(",")); } public static void main(String[] args) throws Exception { String str = "11111,21212,234234,23423424,234234"; List<String> array = stringToList(str); for(String ss:array){ System.out.println(ss); } } }
Running results:
The above is the detailed content of Implementation method of converting string to String array in Java. For more information, please follow other related articles on the PHP Chinese website!