Here you can find the source of minus(String bigger, String smaller)
Parameter | Description |
---|---|
bigger | Bigger string |
smaller | Smaller string |
public static String minus(String bigger, String smaller)
//package com.java2s; /*//from w w w. j ava2 s . com * Copyright (C) 2013 Pavel Stastny * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ public class Main { /** * Minus operator * @param bigger Bigger string * @param smaller Smaller string * @return result of Bigger - Smaller */ public static String minus(String bigger, String smaller) { if (bigger.length() > smaller.length()) { return bigger.replace(smaller, ""); } else throw new IllegalArgumentException(""); } }