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

String strip trailing 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.stripTrailingChar() API. It strips the trailing character if string ends with matching character.

File Name  :  
com/bethecoder/tutorials/jodd/utils/StringStripTrailingTest.java 
Author  :  Sudhakar KV
Email  :  kvenkatasudhakar@gmail.com
   
package com.bethecoder.tutorials.jodd.utils;

import jodd.util.StringUtil;

public class StringStripTrailingTest {

  /**
   @param args
   */
  public static void main(String[] args) {
    System.out.println(StringUtil.stripTrailingChar("1234"'4'));
    System.out.println(StringUtil.stripTrailingChar("786."'.'));
    System.out.println(StringUtil.stripTrailingChar("abcd"'d'));
    System.out.println(StringUtil.stripTrailingChar("abcd"'c'));
  }

}
   

It gives the following output,
123
786
abc
abcd


                    Print

   



Books Recommendation

 
 
bl  br