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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T17:15:52+00:00 2026-06-03T17:15:52+00:00

considering we have following strings and we are going to write them into a

  • 0

considering we have following strings and we are going to write them into a text file:

String a="        "
String b="  "
String c="java "
String d=" java"
String e="java"

but because a and b has no character , we have no interest to insert them into the file.
maybe here its easy to see them and ignore them, but what if there is a DOM tree and we get nodes text one by one and because of lots of white spaces in the page, there are lots of white space strings like [#text: ] in the DOM .
what is the way to find out strings like a and b as blanks and then ignoring them to right it into a text?

  • 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-03T17:15:58+00:00Added an answer on June 3, 2026 at 5:15 pm
    s.trim().length() == 0;
    

    or

    s.trim().isEmpty();
    

    or

    s.matches("\\s*");
    

    or

    StringUtils.isBlank(s);
    

    (that one needs Jakarta Commons Lang). I personally go with the last one as it’s null-safe to boot.

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

Sidebar

Related Questions

I'm considering using Annotations to define my Hibernate mappings but have run into a
I'm trying to write a function that does the following: Given a text file,
I have following questions regarding strings in C++: 1>> which is a better option(considering
I'm considering the following: I have some data stream which I'd like to protect
I have never written a DSL, but I am considering it as a feature
I'm considering using JRuby on App Engine but have heard that Juby app on
Okay considering having the following sample string. Duis posuere suscipit lacus quis lacinia. In
I have recently inherited some Java code and need to integrate it into a
I have to split a huge file into many smaller files. Each of the
Considering the following model: USER Long: PK String: firstName String: lastName USER_EXT Long: PK

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.