File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Two text packages of Java, which to use?

 
Walter Gabrielsen Iii
Ranch Hand
Posts: 158
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to parse text. I'm looking at two packages in Java's API:
java.text
java.util.regex

They both appear to have what I want, so how do I choose which one to use? Which one is recommended, and why does Java have two text packages anyway?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64173
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One is focused on regular expressions. Do you really think that date and number formatting should be placed in the regex package?
 
Paul Clapham
Sheriff
Pie
Posts: 20164
24
MySQL Database
  • 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't see why there has to be a choice between packages. Why is there a rule which says you can't use classes from both packages if you need to do that?
 
Rob Spoor
Sheriff
Pie
Posts: 20369
44
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guess you haven't found javax.swing.text yet
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic