• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Regarding subSequence and subString

 
santhosh kumar vk
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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

Thanks,
Santosh Kumar V.K
 
Stuart A. Burkett
Ranch Hand
Posts: 679
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Assuming you're talking about the String methods, did you read the javadoc for those methods. The answer is in there.
 
Henry Wong
author
Marshal
Pie
Posts: 21184
80
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Winston Gutkowski
Bartender
Pie
Posts: 10422
63
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic