This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Interesting string methods  RSS feed

 
Sarma Lolla
Ranch Hand
Posts: 203
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Except the last two every thing else prints true.
[CODE]
public static void main(String [] args) {
System.out.println("String".substring(0)=="String");
System.out.println("String".substring(0,6)=="String");
System.out.println("String".replace('t','t')=="String");
System.out.println("String".replace('T','t')=="String");
System.out.println("String".toString()=="String");
System.out.println("String".replace('t','T')=="String".replace('t','T'));
System.out.println(" String ".toString()=="String");
}
[CODE]
 
Jasper Vader
Ranch Hand
Posts: 284
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i guess cos the last two are the only two in which an actual change takes place? (t goes to T, the white space gets removed)...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!