Home Tutorials Java StringExamples java.lang.String.replaceFirst



java.lang.String.replaceFirst
Posted on: March 22, 2005 at 12:00 AM
In the example, we are going to show you how to implement the replaceFirst() method in Java application.

In the example, we are going to show you how to implement the replaceFirst() method in Java application.

Generally, replaceFirst() method in Java used to replace the first substring, matching the given regular expression with the given replacement.

A simple example of replaceFirst() method.

public class example {
public static void main(String args[]) {
String xx = "test";
xx = xx.replaceFirst("t","z");
System.out.println(xx);
  }
}

the Output is:
zest

Related Tags for java.lang.String.replaceFirst:


More Tutorials from this section

Ask Questions?    Discuss: java.lang.String.replaceFirst  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.