Use StringTokenizer is right. Can't use split() Thanks ;) On Wed, Oct 6, 2010 at 1:21 PM, Michèle Garoche <[email protected]> wrote:
> > > On Oct 6, 8:04 am, Nguyễn Đình Đoàn <[email protected]> wrote: > > Hi friends, > > > > I hava a String like this: > > > > String s = "abc|123|abc"; > > > > How to split by "|" char (without double quote :d) > You may use StringTokenizer: > > import java.util.StringTokenizer; > > public class Main { > > /** > * @param args the command line arguments > */ > public static void main(String[] args) { > String s = "abc|123|abc"; > > StringTokenizer st = new StringTokenizer(s,"|"); > > while(st.hasMoreTokens()){ > System.out.println(st.nextToken()); > } > } > > } > > which works with regular expressions. > > Michèle Garoche > > -- > To post to this group, send email to > [email protected] > To unsubscribe from this group, send email to > [email protected]<javaprogrammingwithpassion%[email protected]> > For more options, visit this group at > http://groups.google.com/group/javaprogrammingwithpassion?hl=en > -- To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/javaprogrammingwithpassion?hl=en
