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 8442293
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T08:48:47+00:00 2026-06-10T08:48:47+00:00

How do I convert string to upper case String.toUpperCase() ignoring special characters like  

  • 0

How do I convert string to upper case String.toUpperCase() ignoring special characters like   and all others. The problem is that it becomes   and browser does not recognize them as special HTML characters.

I came up with this but it does not cover all special characters:

public static String toUpperCaseIgnoreHtmlSymbols(String str){
    if(str == null) return "";
        str = str.trim();
    str = str.replaceAll("(?i) "," ");
    str = str.replaceAll(""",""");
    str = str.replaceAll("&","&");
    //etc.
    str = str.toUpperCase();
    return str;
}
  • 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-06-10T08:48:49+00:00Added an answer on June 10, 2026 at 8:48 am

    Are you only interested in skipping HTML Entities, or do you also want to skip tags? What about chunks of javascript? URL’s in links?

    If you need to support that kind of stuff, you won’t be able to avoid using a ‘real’ HTML parser instead of a regex. For example, parse the document using jsoup, manipulate the resulting Document, and convert it back to HTML:

    private String upperCase(String str) {
        Document document = Jsoup.parse(str);
        upperCase(document.body());
        return document.html();
    }
    
    private void upperCase(Node node) {
        if (node instanceof TextNode) {
            TextNode textnode = (TextNode) node;
            textnode.text(textnode.text().toUpperCase());
        }
        for (Node child : node.childNodes()) {
            upperCase(child);
        }
    }
    

    now:

    upperCase("This is some <a href=\"http://arnout.engelen.eu\">text&nbsp;with&nbsp;entities</a>");
    

    will produce:

    <html>
      <head></head>
      <body>
        THIS IS SOME 
        <a href="http://arnout.engelen.eu">TEXT&nbsp;WITH&nbsp;ENTITIES</a>
      </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How do I take a string and convert it to lower or upper case
How could one convert a string to upper case. The examples I have found
Is there an inbuilt function to convert C++ string from upper case letters to
i made a program to convert lowercase strings to upper case like strupr(); in
I'm trying to convert an all-uppercase string in Ruby into a lower case one,
How do I convert a wchar_t string from upper case to lower case in
Possible Duplicate: Convert a String In C++ To Upper Case Hi, I need a
When doing case-insensitive comparisons, is it more efficient to convert the string to upper
I am trying to convert the string to upper case, e.g. convert test.pdf to
how to convert a string (wstring) from lowercase to uppercase characters and vice versa?

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.