Here you can find the source of replaceFirstStatement(String source, String regex, String statement)
Parameter | Description |
---|---|
source | a parameter |
regex | a parameter |
statement | a parameter |
public static String replaceFirstStatement(String source, String regex, String statement)
//package com.java2s; //License from project: Apache License import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { /**/*from w w w .ja v a2 s. co m*/ * * @param source * @param regex * @param statement * @return */ public static String replaceFirstStatement(String source, String regex, String statement) { Pattern pattern = Pattern.compile(regex, Pattern.CASE_INSENSITIVE); Matcher matcher = pattern == null ? null : pattern.matcher(source); return matcher == null ? null : matcher.replaceFirst(statement); } }