Java String Chop Left ChopLf(String this_string, String chomp_off)

Here you can find the source of ChopLf(String this_string, String chomp_off)

Description

Chop Lf

License

Open Source License

Declaration

static public String ChopLf(String this_string, String chomp_off) 

Method Source Code

//package com.java2s;
//   Licensed under the Apache License, Version 2.0 (the "License"); you may

public class Main {
    static public String ChopLf(String this_string, String chomp_off) {
        if (!this_string.contains(chomp_off))
            return this_string;
        return this_string.substring(SeekLf(this_string, chomp_off.charAt(0)) + 1, this_string.length());
    }//from w  w  w .j av a  2  s .  co m

    static public String ChopLf(String this_string, String chomp_off, Integer times) {
        if (times == 1)
            return ChopLf(this_string, chomp_off);
        return ChopLf(this_string, chomp_off, times - 1);
    }

    static private int SeekLf(String this_string, char c) {
        for (int i = 0; i < this_string.length(); i++) {
            if (this_string.charAt(i) == c)
                return i;
        }
        return -1;
    }
}

Related

  1. chopFromLeft(String text, char character, int count)
  2. chopLeft(String str, char delimiter)