Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for substringFromLast (0.07 sec)

  1. src/test/java/org/codelibs/core/lang/StringUtilTest.java

            assertEquals("ab", StringUtil.substringFromLast("abc", "c"));
            assertEquals("abcab", StringUtil.substringFromLast("abcabc", "c"));
            assertEquals("abc", StringUtil.substringFromLast("abc", ""));
            assertEquals("abc", StringUtil.substringFromLast("abc", null));
            assertEquals("abc", StringUtil.substringFromLast("abc", "dddd"));
        }
    
        /**
         * @throws Exception
    Registered: Fri Nov 01 20:58:10 UTC 2024
    - Last Modified: Thu Mar 07 01:59:08 UTC 2024
    - 12K bytes
    - Viewed (0)
  2. src/main/java/org/codelibs/core/lang/StringUtil.java

         * 文字列の最後から指定した文字列で始まっている部分より手前を返します。
         *
         * @param str
         *            文字列
         * @param separator
         *            セパレータ
         * @return 結果の文字列
         */
        public static String substringFromLast(final String str, final String separator) {
            if (isEmpty(str) || isEmpty(separator)) {
                return str;
            }
            final int pos = str.lastIndexOf(separator);
            if (pos == -1) {
    Registered: Fri Nov 01 20:58:10 UTC 2024
    - Last Modified: Thu Mar 07 01:59:08 UTC 2024
    - 21.7K bytes
    - Viewed (0)
Back to top