Java String Chomp chomp(String sd, String c)

Here you can find the source of chomp(String sd, String c)

Description

chomp

License

Open Source License

Declaration

public static String chomp(String sd, String c) 

Method Source Code

//package com.java2s;

public class Main {
    public static String chomp(String sd, String c) {
        if (sd == null) {
            return null;
        }//w w w.jav a2  s.c  o m
        if (sd.length() == 0) {
            return "";
        }
        if (sd.endsWith(c)) {
            return sd.substring(0, sd.length() - c.length());
        }

        return sd;
    }
}

Related

  1. chomp(String inStr)
  2. chomp(String options)
  3. chomp(String path)
  4. chomp(String s)
  5. chomp(String s)
  6. chomp(String str)
  7. chomp(String str)
  8. chomp(String str)
  9. chomp(String str)