Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3445066
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:59:42+00:00 2026-05-18T08:59:42+00:00

I find my self constantly changing my utility methods to improve string handling in

  • 0

I find my self constantly changing my utility methods to improve string handling in my Java code. For example I have changed bunch of my search and replace code to use commons StringUtils.replace method. Or upgrading 1.4 to 1.6 java to type safe code.

I would like to ask you to post practices you employ in order to have your string operations run smoothly, securely, fast and the re-usability of your code is fairly simple and elegant.

And if you have pattern to it, even better.

Also if you now about any new 1.7 java features that are worth the while please post them here.

What to do when working with very large strings? Break them up?

What to keep in mind when using regex on strings?

How to utilize cache patterns (and which are the best once) when working with loop intensive algorithms?

Are there libraries that have similar functions as grep, ack, diff | spell check | filter curse words (any words) …

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T08:59:43+00:00Added an answer on May 18, 2026 at 8:59 am

    When possible you should use StringBuilder , especially for concatenating strings. The performance improvement can be very large.

    StringBuilder sb = new StringBuilder("Mat");
    sb.append(" ");
    sb.append("Bank");
    // oops
    int i = sb.indexOf("k");
    sb.insert(i, 'i'); // character
    String mb = sb.toString();
    // result = "Mat Banik"
    

    In a large program the use of s1+s2 is one of the worst and simplest performance hits to cure.

    StringBuilder has almost all the features of String. You can extract substrings without copying. When you need a String (e.g. for Pattern/Matcher) you can convert with toString().

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I find my self having a repeater control which is being databound to an
I've been able to find details on several self-balancing BST s through several sources,
Question is pretty self explanitory. I want to do a simple find and replace,
In Ruby, I'm trying to do the following. def self.stats(since) return Events.find(:all, :select =>
I find myself doing something like this constantly to pull GET args into vars:
Just a simple question on NSStrings, I have a piece of code that assigns
I find my self in a javascript function as a result of a onload
How would i translate these mysql queries to work with sqlite3?: self.find(:first, :conditions =>
I'm using this function that helps my webdevelopers to find a piece of code
I am using vbscript regex to find self-defined tags within a file. \[\$[\s,\S]*\$\] Unfortunately,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.