Replace String with another in java

0 votes

Example #1: What will replace "HelloWorld" with "World"?

Aug 21, 2018 in Java by samarth295
• 2,220 points
884 views

1 answer to this question.

+1 vote
String s = "HelloSuresh";
s = s.replace("Hello","");
System.out.println(s);
answered Aug 21, 2018 by Parth
• 4,640 points

Related Questions In Java

0 votes
2 answers

How to left pad a string with zero in java?

String paddedString = org.apache.commons.lang.StringUtils.leftPad("129018", 10, "0") the second ...READ MORE

answered Aug 31, 2018 in Java by Sushmita
• 6,920 points
3,216 views
0 votes
1 answer

Replace all 0's with 5 in Java

Take a look at this, hope this ...READ MORE

answered Mar 6, 2019 in Java by Priyaj
• 58,020 points
6,378 views
0 votes
1 answer

Java replace : replace all charecters with space except the matched string like "test"

Hi, @jyra, You can go through this example:  String ...READ MORE

answered Oct 14, 2020 in Java by Gitika
• 65,770 points
799 views
+5 votes
4 answers

How to execute a python file with few arguments in java?

You can use Java Runtime.exec() to run python script, ...READ MORE

answered Mar 27, 2018 in Java by DragonLord999
• 8,450 points

edited Nov 7, 2018 by Omkar 81,380 views
0 votes
3 answers

Check if a String is numeric in Java

Java 8 Lambda Expression is used: String someString ...READ MORE

answered Sep 3, 2018 in Java by Daisy
• 8,140 points
3,737 views
0 votes
2 answers

Generate an alpha-numeric string randomly

Java supplies a way of doing this ...READ MORE

answered Jul 18, 2018 in Java by Daisy
• 8,140 points
2,657 views
0 votes
1 answer

How do I create a Java string from the contents of a file?

If you're looking for an alternative that ...READ MORE

answered Apr 19, 2018 in Java by Rishabh
• 3,620 points
1,211 views
0 votes
2 answers

Counting no of Occurrence of a particular character inside a string in Java

We can find out the no. of ...READ MORE

answered Sep 7, 2018 in Java by Sushmita
• 6,920 points
2,817 views
0 votes
1 answer
0 votes
4 answers

Remove extra spaces from string in java

import java.util.regex.Matcher; import java.util.regex.Pattern; String pattern="[\\s]"; String replace=""; part="name=john age=13 year=2001"; Pattern ...READ MORE

answered Sep 10, 2018 in Java by Parth
• 4,640 points
3,104 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP