*
The moose likes Beginning Java and the fly likes Two text packages of Java, which to use? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Two text packages of Java, which to use?" Watch "Two text packages of Java, which to use?" New topic
Author

Two text packages of Java, which to use?

Walter Gabrielsen Iii
Ranch Hand

Joined: Apr 09, 2011
Posts: 158
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

Joined: Jan 10, 2002
Posts: 60740
    
  65

One is focused on regular expressions. Do you really think that date and number formatting should be placed in the regex package?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

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

Joined: Oct 27, 2005
Posts: 19649
    
  18

Guess you haven't found javax.swing.text yet


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
Consider Paul's rocket mass heater.
 
subject: Two text packages of Java, which to use?
 
Similar Threads
How to complile java classes which exist in different Packages
swing and awt packeg
How does Java deal with two classes that have the same class names and parameters....
about the FTP
exam II & III passed with 97%