Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**
     * Replace, paste arguments one after the other into 
     * the base at positions specified by a RegEx string.
     * 
     * @param base The input string.
     * @param regex The pattern for search.
     * @param args The replacements.
     * @return The modified original string.
     */
    public static String paste(String base, String regex, String... args) {
        for (String arg : args) {
            base = base.replaceFirst(regex, arg);
        }
        return base;
    }
}