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

  • Home
  • SEARCH
  • 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 795429
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T22:28:46+00:00 2026-05-14T22:28:46+00:00

I have a string that looks like this: CALDARI_STARSHIP_ENGINEERING and I need to edit

  • 0

I have a string that looks like this:

CALDARI_STARSHIP_ENGINEERING

and I need to edit it to look like

Caldari Starship Engineering

Unfortunately it’s three in the morning and I cannot for the life of me figure this out. I’ve always had trouble with replacing stuff in strings so any help would be awesome and would help me understand how to do this in the future.

  • 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-14T22:28:46+00:00Added an answer on May 14, 2026 at 10:28 pm

    Something like this is simple enough:

        String text = "CALDARI_STARSHIP_ENGINEERING";
        text = text.replace("_", " ");
        StringBuilder out = new StringBuilder();
        for (String s : text.split("\\b")) {
            if (!s.isEmpty()) {
                out.append(s.substring(0, 1) + s.substring(1).toLowerCase());
            }
        }
        System.out.println("[" + out.toString() + "]");
        // prints "[Caldari Starship Engineering]"
    

    This split on the word boundary anchor.

    See also

    • regular-expressions.info/Word boundary

    Matcher loop solution

    If you don’t mind using StringBuffer, you can also use Matcher.appendReplacement/Tail loop like this:

        String text = "CALDARI_STARSHIP_ENGINEERING";
        text = text.replace("_", " ");
    
        Matcher m = Pattern.compile("(?<=\\b\\w)\\w+").matcher(text);
        StringBuffer sb = new StringBuffer();
        while (m.find()) {
            m.appendReplacement(sb, m.group().toLowerCase());
        }
        m.appendTail(sb);
        System.out.println("[" + sb.toString() + "]");
        // prints "[Caldari Starship Engineering]"
    

    The regex uses assertion to match the “tail” part of a word, the portion that needs to be lowercased. It looks behind (?<=...) to see that there’s a word boundary \b followed by a word character \w. Any remaining \w+ would then need to be matched so it can be lowercased.

    Related questions

    • Use Java and RegEx to convert casing in a string
      • Java regex does not support Perl preprocessing operations \l \u, \L, and \U.
    • Java split is eating my characters.
      • More examples of using assertions
    • StringBuilder and StringBuffer in Java
      • Unfortunately, appendReplacement/Tail only takes StringBuffer
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string that looks like this: 'p10005c4' I need to extract the
I have a string that looks like this: (12.0+10)*31 I need to be able
i have a string that looks like this: /dir/location/test-load-ABCD.p and i need to parse
I have a string that looks like this: the word you need is 'hello'
I have a string that looks like this: [2005] one two three [2004] six
I have a string that looks like this. That I need to decode. DE9F6B7AB96AA0D5B01F8E51BE2B4D8951CC2C8A10E42F5EA1DB089D677BF15E
I have a string that looks like this... http://www.example.com/ example.pdf I need to remove
I have a string that looks like this +0.6810+0.0266-0.0140-0.0111-0.0080-00.026-0.0229+000.84 I need to parse this
I have a String that looks like this String = Förpackning Flaska (375 ml)
I have a string that looks like this: <name>-<gender>-<age>.jpg I want to be very

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.