The Artima Developer Community
Sponsored Link

Java Buzz Forum
Java 5: String.regionMatches()

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
dion

Posts: 5028
Nickname: dion
Registered: Feb, 2003

Dion Almaer is the Editor-in-Chief for TheServerSide.com, and is an enterprise Java evangelist
Java 5: String.regionMatches() Posted: Jan 17, 2005 2:25 AM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by dion.
Original Post: Java 5: String.regionMatches()
Feed Title: techno.blog(Dion)
Feed URL: http://feeds.feedburner.com/dion
Feed Description: blogging about life the universe and everything tech
Latest Java Buzz Posts
Latest Java Buzz Posts by dion
Latest Posts From techno.blog(Dion)

Advertisement
Kirk talks about the new regionMatches(..) methods available in the Java 5 String class. There were questions on readability, and Kirk has a benchmark to proove the micro-performance. I think the methods definitely harder to grok at first, and there is room for helper methods (e.g. in the first case: foo.startsWithIgnoreCase(bar)). Case-folding startsWith() If you’ve ever written code like if (foo.toLowerCase().startsWith(bar.toLowerCase())) ... and winced, because you were creating and throwing away two Strings, then rejoice! Now you may if (foo.regionMatches(true, 0, bar, 0, bar.length())) ... Comparison of arbitrary string regions Before: if (foo.equals(bar.substring(m))) ... After: if (foo.regionMatches(0, bar, m, bar.length() - m)) ...

Read: Java 5: String.regionMatches()

Topic: Testing Email -- Mocking JavaMail and Dumbster Previous Topic   Next Topic Topic: Logging and Performance

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use