Android String Sub String Get deleteLastIf(String str, String eq_str)

Here you can find the source of deleteLastIf(String str, String eq_str)

Description

delete Last If

License

Apache License

Declaration

public static final String deleteLastIf(String str, String eq_str) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static final String deleteLastIf(String str, String eq_str) {
        if (str == null)
            return null;
        if (str.substring(str.length() - eq_str.length(), str.length())
                .equals(eq_str)) {//from w  w w.j a  va2 s .c  o m
            return str.substring(0, str.length() - eq_str.length());
        } else {
            return str;
        }
    }
}

Related

  1. left(String str, int length)
  2. right(String str, int length)
  3. delSuffix(String str)
  4. deleteLast(String str, int num)
  5. getTailorString(String string, int length)
  6. mid(String str, int beginIndex, int length)
  7. subStringByByte(String str, int startPos, int length)
  8. subStringByByte(String paramString, int beginIndex, int endIndex)