Java String Sub String substringBeforeLastIgnoreCase(final String target, final String separator)

Here you can find the source of substringBeforeLastIgnoreCase(final String target, final String separator)

Description

substring Before Last Ignore Case

License

Apache License

Declaration

public static String substringBeforeLastIgnoreCase(final String target, final String separator) 

Method Source Code

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

public class Main {

    public static String substringBeforeLastIgnoreCase(final String target, final String separator) {
        if ("".equals(target))
            return target;
        if ("".equals(separator))
            return target;
        final String tempStr = target.toUpperCase();
        final String tempSeparator = separator.toUpperCase();

        final int index = tempStr.lastIndexOf(tempSeparator);
        if (index == -1)
            return target;
        return target.substring(0, index);
    }//from ww w  . j  a v a  2 s .c o m
}

Related

  1. substringBeforeLast(String str, String separator)
  2. substringBeforeLast(String str, String separator)
  3. subStringBeforeLast(String str, String separator)
  4. substringBeforeLast(String text, String separator)
  5. substringBeforeLastChar(String str, String separator)
  6. substringBetween(final String s, final String tag)
  7. substringBetween(final String str, final String startToken, final String endToken)
  8. substringBetween(String line, final String delimiterBefore, final String delimiterAfter)
  9. substringBetween(String s, String part1, String part2)