Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    public static String formatPhone(String phone) {
        if (!checkString(phone)) {
            return phone;
        }
        phone = phone.replace("-", "");
        phone = phone.replace(" ", "");
        return phone;
    }

    public static boolean checkString(String src) {
        if (src == null) {
            return false;
        }
        if (src.trim().length() == 0) {
            return false;
        }
        return true;
    }
}