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 

import java.util.Locale;

public class Main {
    private static String replaceInside(String content, String character, String format) {
        try {
            int index;
            while ((index = content.indexOf(character)) >= 0) {
                int endIndex = content.indexOf(character, index + 1);
                String inside = String.format(Locale.getDefault(), format, content.substring(index + 1, endIndex));
                content = content.replace(content.substring(index, endIndex + 1), inside);
            }
        } catch (StringIndexOutOfBoundsException e) {
            e.printStackTrace();
        }

        return content;
    }
}