trim string from left - Android java.lang

Android examples for java.lang:String Strip

Description

trim string from left

Demo Code

import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.text.Editable;
import android.text.SpannedString;
import android.util.Pair;

public class Main{

    public static String ltrim(String str, char target) {
        if (str.length() > 0 && str.charAt(str.length() - 1) == target) {
            str = str.substring(0, str.length() - 1);
        }/*w w w  . java  2  s . com*/
        return str;
    }

}

Related Tutorials