Here you can find the source of Split(String Str, char splitchar)
Parameter | Description |
---|---|
Str | String ????? |
splitchar | char ?????? |
public static ArrayList Split(String Str, char splitchar)
//package com.java2s; import java.util.ArrayList; public class Main { /**// w ww. ja v a2 s .c o m * ?????? * * @param Str * String ????? * @param splitchar * char ?????? * @return ArrayList */ public static ArrayList Split(String Str, char splitchar) { if (Str != null) { ArrayList ret = new ArrayList(); StringBuffer tmpBuffer = new StringBuffer(); for (int i = 0; i < Str.length(); i++) { if (Str.charAt(i) != splitchar) tmpBuffer.append(Str.charAt(i)); else { ret.add(tmpBuffer.toString()); tmpBuffer.delete(0, tmpBuffer.length()); } } if (tmpBuffer.length() > 0) { ret.add(tmpBuffer.toString()); tmpBuffer.delete(0, tmpBuffer.length()); } return ret; } else return new ArrayList(); } }