File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Divide a String Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Divide a String " Watch "Divide a String " New topic
Author

Divide a String

mark issac
Greenhorn

Joined: Oct 07, 2004
Posts: 5
Hi
Anybody can give suggestion how to Divide a big string into small part
Any Code-sample is Appreciated
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
Mark,
This question is not related to webservies. I am moving this to "java in general" forum, folks their can help you.
Cheers
Balaji
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24184
    
  34

Depending on what you need to do, your best bets are either the String.split() method or the java.util.StringTokenizer class. Do you want to explain in a bit more detal what you want to accomplish?


[Jess in Action][AskingGoodQuestions]
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
If you know the positions you want to divide, then you can use substring
Lionel Badiou
Ranch Hand

Joined: Jan 06, 2005
Posts: 140
Hello Marc,

Just a note : java.util.StringTokenizer class is depreciated.
So you may find your way through Enerst and Keith suggestions : use split(String) or substring(int) from String class.

Hope that helps,


Lionel Badiou
CodeFutures Software
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24184
    
  34

Originally posted by Lionel Badiou:

Just a note : java.util.StringTokenizer class is depreciated.


The word is deprecated, and no, it's not. Go check if you don't believe me.
Lionel Badiou
Ranch Hand

Joined: Jan 06, 2005
Posts: 140
Well, my apologies Ernest Here is indeed the accurate status of StringTokenizer :

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.

Consequently, StringTokenizer is not deprecated as Ernest said, yet its use is discouraged

Best regards,
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Divide a String