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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:41:15+00:00 2026-05-26T21:41:15+00:00

I want to know if a String such as equi-distant or they’re contains a

  • 0

I want to know if a String such as “equi-distant” or “they’re” contains a non-word character. Is there a simple way to check for it?

  • 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-26T21:41:15+00:00Added an answer on May 26, 2026 at 9:41 pm

    It depends entirely on what you mean by “word character”.

    If by “word character” you mean A-Z or a-z then you can use this:

    bool containsNonWordCharacter = s.matches(".*[^A-Za-z].*");
    

    If you mean “any character that is considered to be a letter in Unicode”, then look at Character.isLetter instead.

    This is code provided by bobbymcr nearly works:

    public static boolean hasNonWordCharacter(String s) {
        char[] a = s.toCharArray();
        for (char c : a) {
            if (!Character.isLetter(c)) {
                return true;
            }
        }
    
        return false;
    }
    

    However see the documentation:

    Note: This method cannot handle supplementary characters. To support all Unicode characters, including supplementary characters, use the isLetter(int) method.

    This should work for all Unicode characters:

    public static boolean hasNonWordCharacter(String s) {
    
        int offset = 0, strLen = str.length();
        while (offset < strLen) {
            int curChar = str.codePointAt(offset);
            offset += Character.charCount(curChar);
            if (!Character.isLetter(curChar)) {
                return true;
            }
        }
    
        return false;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to know the reason why there are macros such as T, TEXT,
want to know why String behaves like value type while using ==. String s1
i'm amol kadam,I want to know how to split string in two part.My string
i want to remove a particular #keyword from a string. i dont know its
Want to know what the stackoverflow community feels about the various free and non-free
What's the easiest way of decoding a string such that: 'Bayern M&#xFC;nchen' -> 'Bayern
I just want to know if there's an approach in VB.NET that can find
What the title says. I want to know if there something in the JDK
I want to know whether we can do such in Delphi: I have a
i'v got such string <>1 <>2 <>3 i want remove all '<>' and symbols

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.