extract Last Line - Java 2D Graphics

Java examples for 2D Graphics:Shape

Description

extract Last Line

Demo Code


//package com.java2s;

public class Main {
    public static String extractLastLine(String input) {
        int lastIndexOf = input.lastIndexOf('\n');
        if (lastIndexOf == -1 || lastIndexOf + 1 > input.length())
            return "";
        return input.substring(lastIndexOf + 1);
    }/* w  w  w .  j  av a 2s.c o m*/
}

Related Tutorials