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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:27:47+00:00 2026-06-11T23:27:47+00:00

I have 1. This is a test message I want to print This is

  • 0

I have

1. This is a  test message

I want to print

This is a  test message

I am trying

String delimiter=".";
String[] parts = line.split(delimiter);
int gg=parts.length;

Than want to print array

 for (int k ;k <gg;K++)
    parts[k];

But my gg is always 0.
am I missing anything.
All I need is to remove the number and . and white spaces

The number can be 1 (or) 5 digit number

  • 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-11T23:27:48+00:00Added an answer on June 11, 2026 at 11:27 pm

    You are using "." as a delimiter, you should break the special meaning of the . char.

    The . char in regex is “any character” so your split is just splitting according to “any character”, which is obviously not what you are after.

    Use "\\." as a delimiter

    For more information on pre-defined character classes you can have a look at the tutorial.

    For more information on regex on general (includes the above) you can try this tutorial


    EDIT:

    P.S. What you are up to (removing the number) can be achieved with a one-liner, using the String.replaceAll() method.

    System.out.println(line.replaceAll("[0-9]+\\.\\s+", ""));
    

    will provide output

    This is a  test message
    

    For your input example.

    The idea is: [0-9] is any digit. – the + indicate there can be any number of them, which is greater then 0. The \\. is a dot (with breaking as mentioned above) and the \\s+ is at least one space.

    It is all replaced with an empty string.

    Note however, for strings like: "1. this is a 2. test" – it will provide “this is a test”, and remove the “2. ” as well, so think carefully if that is indeed what you are after.

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

Sidebar

Related Questions

I have this code inside a iframe: window.addEventListener('message', function(e){ if(e.data == 'test') console.log(e); },
I have this json object : { msg_id:134, message:Dick, comment:[ { com_id:9, comment:test, msg_id:134,
I have this test slider http://jsfiddle.net/dUyLY/2/ In Chrome it works nice, but in firefox
I have this test [Test] public void SaveInventoryItemLoad_Will_Call_WCF_Service_SaveInventoryItemLoad() { adapter.SaveInventoryItemLoad(new List<InventoryItemLoadProxy>()); itemMasterBusinessClientMock.Verify(x => x.SaveInventoryItemLoad(It.IsAny<List<InventoryItemLoadProxy>>()),
I have this test case def setUp(self): self.user = User.objects.create(username=tauri, password='gaul') def test_loginin_student_control_panel(self): c
I have this test code that just saves an XML file to a folder.
Note: I'm using Google Chrome Currently I have this test page http://www.evecakes.com/doodles/canvas_size_issue.htm It should
I have this table Test as Id, SomeValue, SomeText contains about a mill records,
I have this JUnit test that I need help developing a Interface and Class
I have this simple test project just to test the IncludeExceptionDetailInFaults behavior. public class

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.