Results 1 to 4 of 4
  1. #1
    fuzzdn is offline Member
    Join Date
    Dec 2010
    Posts
    10
    Rep Power
    0

    Default String Tokenizer, no delimiters

    How would i go about splitting a string into tokens where the tokens are separated by data type.

    For example,

    I would want to split the following:

    "(15+3)/2"

    into:
    (
    15
    +
    3
    )
    /
    2

    thanks for any help

  2. #2
    j2me64's Avatar
    j2me64 is offline Senior Member
    Join Date
    Sep 2009
    Location
    Zurich, Switzerland
    Posts
    962
    Rep Power
    6

    Default

    you can use a regex-expression for splitting your string. for more information please read the regex api

  3. #3
    fuzzdn is offline Member
    Join Date
    Dec 2010
    Posts
    10
    Rep Power
    0

    Default

    Ive given the API a read through and researched a bit. But its still a bit unclear to me how to tackle it.

    The metacharacters are what i need to use i guess.

    Can you just give me a nudge off in the right direction how to do this. Im pretty much blank at the moment

    Thanks for any help

  4. #4
    fuzzdn is offline Member
    Join Date
    Dec 2010
    Posts
    10
    Rep Power
    0

    Default

    Resolved this.

    Came up with a way of doing it using a simple while loop.

    no need for regex expression.

    Thanks for the help though, much appreciated

Similar Threads

  1. String Tokenizer
    By sumaih in forum Java Gaming
    Replies: 2
    Last Post: 08-21-2010, 03:23 PM
  2. String Tokenizer
    By viperlasson in forum New To Java
    Replies: 1
    Last Post: 03-09-2010, 01:14 PM
  3. String Tokenizer
    By redasu in forum Advanced Java
    Replies: 4
    Last Post: 02-19-2010, 03:30 AM
  4. Replies: 5
    Last Post: 11-04-2009, 02:25 AM
  5. Replies: 4
    Last Post: 07-07-2008, 01:32 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •