Results 1 to 4 of 4

Thread: Tokenize text

  1. #1
    Syahrul is offline Member
    Join Date
    Nov 2009
    Posts
    12
    Rep Power
    0

    Default Tokenize text

    What do you use to tokenize a text?
    Thank you

  2. #2
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Location
    Germany
    Posts
    1,430
    Rep Power
    7

    Default

    String.split() or a StringTokenizer.
    Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
    The Ubiquitous Newbie Tips

  3. #3
    CodesAway's Avatar
    CodesAway is offline Senior Member
    Join Date
    Sep 2009
    Location
    Texas
    Posts
    238
    Rep Power
    5

    Default

    Isn't StringTokenizer outdated?

    I use either a Scanner object or a regular expression (Pattern/Matcher class), depending on what I need to do.
    CodesAway - codesaway.info
    writing tools that make writing code a little easier

  4. #4
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    From Java API,

    StringTokenizer is a legacy class that is retained for compatibility reasons although its use is discouraged in new code. It is recommended that anyone seeking this functionality use the split method of String or the java.util.regex package instead.
    StringTokenizer possibly be deprecated, but still couldn't found in Java6. Most of the cases my choice is Regex and Split method.

Similar Threads

  1. Replies: 8
    Last Post: 11-06-2009, 06:52 AM
  2. Replies: 2
    Last Post: 01-23-2009, 04:09 PM
  3. printing simple text as text on printer
    By Nicholas Jordan in forum Advanced Java
    Replies: 0
    Last Post: 12-01-2008, 01:42 AM
  4. find and replace text from a text file
    By gezzel in forum New To Java
    Replies: 2
    Last Post: 09-19-2008, 04:04 PM
  5. Replies: 0
    Last Post: 05-26-2008, 04:26 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
  •