Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {
    /**
     * @param str
     * @return String.
     */
    public static String multiSpace2singleSpace(String str) {
        Pattern pattern;
        Matcher matcher;
        pattern = Pattern.compile("[\\s]+");
        matcher = pattern.matcher(str);
        return matcher.replaceAll(" ");
    }
}