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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T04:30:54+00:00 2026-05-31T04:30:54+00:00

I want to find a text within the string and replace it but it’s

  • 0

I want to find a text within the string and replace it but it’s not working my code. I have to mention that i get normally the Title of the webview, but when i output the text2 i get the whole title (does not replace the text). Also all strings except from text2 , located within a void.

String text1 = web1.getTitle();
String text2 = text1.toString().replace("-Click 2U - Files", "");

Thank you in advance….

  • 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-31T04:30:56+00:00Added an answer on May 31, 2026 at 4:30 am

    Your code works for me:

     String text1 = "some string with -Click 2U - Files in it";
     String text2 = text1.replace("-Click 2U - Files", "");
     // here text2.equals("some string with  in it")
    

    This will remove all instances of the string. You can also use replaceAll(...) which uses regular expressions:

     String text1 = "some Click 2U title for Clicking away";
     String text2 = text1.replaceAll("C.*?k", "XXX");
     // here text2.equals("some [XXX 2U title for XXXing away")
    

    Notice that the "C.*?k"pattern will match a C and then any number of characters and then k. The ? means don’t do an eager match and stop at the first k. Read your regex manuals for more details there.

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

Sidebar

Related Questions

I have two MySQL tables, and I want to find and replace text strings
I want to find any text in a file that matches a regexp of
I want to find all img tags in a string of text and put
i want a php function probably regular expression to find and replace a string
I have a JTextPane and I have some text within that JTextPane. However, because
I have a text field within Flash that contains a block of (obviously) text.
I have an XML file containing some scientific text that I want to display
I have to find occurrences of a certain string (needle) within another string (haystack)
It's quite easy to find specific text with JQuery but I want to find
I have a span that contains text that I would like to use. But

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.