*
The moose likes Java in General and the fly likes Regarding subSequence and subString 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 » Java in General
Bookmark "Regarding subSequence and subString" Watch "Regarding subSequence and subString" New topic
Author

Regarding subSequence and subString

santhosh kumar vk
Ranch Hand

Joined: Aug 25, 2009
Posts: 144
Hi,

Could you please tell me the difference between subSequence and subString in java.

Thanks,
Santosh Kumar V.K
Stuart A. Burkett
Ranch Hand

Joined: May 30, 2012
Posts: 679
Assuming you're talking about the String methods, did you read the javadoc for those methods. The answer is in there.
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18508
    
  40

santhosh kumar vk wrote:Hi,

Could you please tell me the difference between subSequence and subString in java.

Thanks,
Santosh Kumar V.K



I am assuming that you are referring to the methods of the java.lang.String class?

If so, then the javadoc is a good place to start here.... basically, the two methods do the same thing. In fact, I believe subSequence() calls subString(). And the reason is also explained in the JavaDoc.

[EDIT] beaten to the answer by only 20 seconds...

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 7517
    
  18

santhosh kumar vk wrote: Could you please tell me the difference between subSequence and subString in java.

One is a method of String; the other a method of CharSequence (which is newer) and, since String implements CharSequence (at least since Java 1.4), it must implement subSequence() and, as has already been mentioned, its implementation is identical to substring().

Winston

Isn't it funny how there's always time and money enough to do it WRONG?
Articles by Winston can be found here
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Regarding subSequence and subString
 
Similar Threads
SubString PROBLEM. HELP ASAP!!!
subString
Extracting certain values from a string
String split is not working properly
Important Question From MarcusGreen