Here you can find the source of explode(String handleStr, String pointStr)
Parameter | Description |
---|---|
handleStr | a parameter |
pointStr | a parameter |
public static Vector explode(String handleStr, String pointStr)
//package com.java2s; //License from project: Apache License import java.util.*; public class Main { /**// w w w .j a va 2s .c om * explode, separate string into a Vector * * @param handleStr * @param pointStr * @return Vector, include separated string */ public static Vector explode(String handleStr, String pointStr) { Vector v = new Vector(); int pos1, pos2; try { if (handleStr.length() > 0) { pos1 = handleStr.indexOf(pointStr); pos2 = 0; while (pos1 != -1) { v.addElement(handleStr.substring(pos2, pos1)); pos2 = pos1 + pointStr.length(); pos1 = handleStr.indexOf(pointStr, pos2); } v.addElement(handleStr.substring(pos2)); } } catch (Exception error) { error.printStackTrace(); } return v; } }