Java String Suffix suffix(String input, char delimiter)

Here you can find the source of suffix(String input, char delimiter)

Description

Return the remainder of the string after the last occurrence of the delimiter char

License

Open Source License

Parameter

Parameter Description
input a parameter
delimiter a parameter

Declaration

public static String suffix(String input, char delimiter) 

Method Source Code

//package com.java2s;
// This package is part of the Spiralcraft project and is licensed under

public class Main {
    /**// ww  w  .ja v  a  2s.  c  o m
     * Return the remainder of the string after the last occurrence of the 
     *   delimiter char
     * 
     * @param input
     * @param delimiter
     * @return
     */
    public static String suffix(String input, char delimiter) {
        if (input == null) {
            return null;
        }
        int pos = input.lastIndexOf(delimiter);
        if (pos >= 0) {
            if (input.length() > pos + 1) {
                return input.substring(pos + 1);
            } else {
                return "";
            }
        }
        return null;

    }
}

Related

  1. suffix(final String source, final String target)
  2. suffix(String fname)
  3. suffix(String mime)
  4. suffix(String name, char separator)
  5. suffix(String name, String suffix)
  6. suffix(String prefix, String path)