Java Number Minus minus(String bigger, String smaller)

Here you can find the source of minus(String bigger, String smaller)

Description

Minus operator

License

Open Source License

Parameter

Parameter Description
bigger Bigger string
smaller Smaller string

Return

result of Bigger - Smaller

Declaration

public static String minus(String bigger, String smaller) 

Method Source Code

//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("");
    }
}

Related

  1. minus(double[][] x, double[][] y, double[][] r)
  2. minus(int flags, int set)
  3. minus(Integer a, Integer b)
  4. minus(Number n)
  5. minus(Number n)
  6. minus(String second, String first)
  7. minus128(int v)
  8. minuscula(char c)
  9. minusculas(char c)