切分句子(非正则)

	/**
	 * @function
	 * @param source 待分句的句子
	 * @param div 分隔符
	 * @param include 结果中是否包含分隔符
	 * @return
	 */
	public static String[] split(String source, String div, boolean include) {

		StringTokenizer tokens = new StringTokenizer(source, div, include);
		String[] result = new String[tokens.countTokens()];
		int i = 0;
		while (tokens.hasMoreTokens()) {
			result[i++] = tokens.nextToken();
		}
		return result;
	}

你可能感兴趣的:(切分句子(非正则))