get Substring After - Java java.lang

Java examples for java.lang:String Substring

Description

get Substring After

Demo Code

//package com.java2s;

public class Main {
    public static void main(String[] argv) {
        String s = "java2s.com";
        char c = 'o';
        System.out.println(getSubstringAfter(s, c));
    }/*  ww w. java2 s .c o  m*/

    public static String getSubstringAfter(String s, char c) {
        return s.substring(s.lastIndexOf(c) + 1).trim();
    }
}

Related Tutorials