Java String replaceFirst method Example

Java String replaceFirst method Example
/**
 * @author lautturi.com 
 * Java example: Replace the first substring of string in java
 */

import java.util.*;

public class Lautturi {
	public static void main(String[] args) {

		String str = "welcom to java world. java is a high-level programming language.";
		
		System.out.println(str);
		System.out.println(str.replaceFirst("java", "python"));

	}
}
Source:w‮ww‬.lautturi.com

output:

welcom to java world. java is a high-level programming language.
welcom to python world. java is a high-level programming language.
Created Time:2017-09-28 21:26:28  Author:lautturi