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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T01:47:35+00:00 2026-05-14T01:47:35+00:00

String a =the STRING TOKENIZER CLASS ALLOWS an APPLICATION to BREAK a STRING into

  • 0
String a ="the STRING TOKENIZER CLASS ALLOWS an APPLICATION to BREAK a STRING into TOKENS.  ";

StringTokenizer st = new StringTokenizer(a);
while (st.hasMoreTokens()){
  System.out.println(st.nextToken());

Given above codes, the output is following,

the
STRING TOKENIZER CLASS
ALLOWS
an
APPLICATION
to
BREAK
a
STRING
into
TOKENS. 

My only question is why the “STRING TOKENIZER CLASS” has been combined into one token????????

When I try to run this code,

System.out.println("STRING TOKENIZER CLASS".contains(" "));

It printed funny result,

FALSE

It sound not logical right? I’ve no idea what went wrong.

I found out the reason, the space was not recognized as valid space by Java somehow. But, I don’t know how it turned up to be like that from the front processing up to the code that I’ve posted.

Guys, I need to highlight that, below code runs first before the above one..

if (!suspectedContentCollector.isEmpty()){
Iterator i = suspectedContentCollector.iterator();
String temp=””;
while (i.hasNext()){
temp+=i.next().toLowerCase()+ ” “;
}
StringTokenizer st = new StringTokenizer(temp);

        while (st.hasMoreTokens()){
            temp=st.nextToken();
            temp=StopWordsRemover.remove(temp);
            analyzedSentence = analyzedSentence.replace(temp,temp.toUpperCase());
        }
    }

Hence, once it has been changed to UPPERCASE, something seems to went wrong somewhere and I realized only certain spaces were not recognized. Could it be the reason of retrieving the text from the document?

Following code,

String a =”the STRING TOKENIZER CLASS ALLOWS an APPLICATION to BREAK a STRING into TOKENS.  “;
for (int i : a.toCharArray()) {
System.out.print(i + ” “);
}

produced following output,

116
104
101
32
83
84
82
73
78
71
160
84
79
75
69
78
73
90
69
82
160
67
76
65
83
83
32
65
76
76
79
87
83
32
97
110
32
65
80
80
76
73
67
65
84
73
79
78
32
116
111
32
66
82
69
65
75
32
97
32
83
84
82
73
78
71
32
105
110
116
111
32
84
79
75
69
78
83
46
160
32

  • 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-14T01:47:36+00:00Added an answer on May 14, 2026 at 1:47 am

    Looking at the character codes, the ‘space’ in question is 0xA0, which is intended to be a non-breaking space. My guess is that it was entered deliberately so that ‘STRING TOKENIZER CLASS’ is treated as one word.

    The solution (if you indeed deem it correct to break up ‘STRING TOKENIZER CLASS’ into three words) would be to pass add the non-breaking space as delimiter to the StringTokenizer class (resp. the String.split() method). E.g.

      new StringTokenizer(string, " \t\n\r\f\240")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 433k
  • Answers 433k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer No, the common way is to use a loop which… May 15, 2026 at 2:59 pm
  • Editorial Team
    Editorial Team added an answer Save the URL of the last page visited in the… May 15, 2026 at 2:59 pm
  • Editorial Team
    Editorial Team added an answer [KnownType] is needed to tell it about subtypes. The disadvantage… May 15, 2026 at 2:59 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.