java 切割字符串

public class Spilt {

	public static void main(String[] args) {
        String sourceStr = "11111|22222|33333|44444|55555";
        String[] sourceStrArray = sourceStr.split("\\|");
        for (int i = 0; i < sourceStrArray.length; i++) {
            System.out.println("part"+(i+1)+":"+sourceStrArray[i]);
        }

      
    }
}

你可能感兴趣的:(java)