Home  | My Account  |  Membership
WorldDeveloper.org
Forum Details
Topics
Posts
Categories
 
577 member(s)
718,905 hit(s)
14 categories
51 topics
26 messages
0 online
Forums: Code Post
J2ME: Split a string by character, StringTokenizer
hostj2me
43 topic(s)
23 post(s)

March 05, 2007 5:51 PM


public static Vector split(String s, char c)
{
Vector parts = new Vector();
if ( s != null )
{
int lastfound = 0;
int pos = 0;
while ( (lastfound = s.indexOf(c,pos)) != - 1 )
{
parts.addElement(s.substring(pos,lastfound));
pos = lastfound+1;
}
if ( pos < s.length() ) parts.addElement(s.substring(pos));
}

return parts;
}



edited by hostj2me 4/28/07 9:43 PM


©2008 WorldDeveloper.org - PO Box 310575 Miami, FL 33231

WorldDeveloper.org is a managed social network for application developers around the world.