tl  tr
  Home | Tutorials | Articles | Videos | Products | Tools | Search
Interviews | Open Source | Tag Cloud | Follow Us | Bookmark | Contact   
 Tools and Libs > Jodd > Strings > String strip leading char

String strip leading char 

Jodd is an open-source java library with lot of reusable components and feature rich utilities. This requires the library jodd-3.3.2.jar to be in classpath. The following example shows how to use StringUtil.stripLeadingChar() API. It strips the leading character if string starts with matching character.

File Name  :  
com/bethecoder/tutorials/jodd/utils/StringStripLeadingTest.java 
Author  :  Sudhakar KV
Email  :  [email protected]
   
package com.bethecoder.tutorials.jodd.utils;

import jodd.util.StringUtil;

public class StringStripLeadingTest {

  /**
   @param args
   */
  public static void main(String[] args) {
    System.out.println(StringUtil.stripLeadingChar("$1234"'$'));
    System.out.println(StringUtil.stripLeadingChar(".786"'.'));
    System.out.println(StringUtil.stripLeadingChar("abcd"'a'));
    System.out.println(StringUtil.stripLeadingChar("abcd"'b'));
  }

}
   

It gives the following output,
1234
786
bcd
abcd



 
  


  
bl  br