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

String suffix 

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.suffix() API. It appends suffix if the given string doesn't end with specified suffix.

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

import jodd.util.StringUtil;

public class StringSuffixTest {

  /**
   @param args
   */
  public static void main(String[] args) {
    System.out.println(StringUtil.suffix("aaaa""B"));
    System.out.println(StringUtil.suffix("aaaaB""B"));
    
    System.out.println(StringUtil.suffix("acac""a"));
    System.out.println(StringUtil.suffix("acac""ac"));
    
    System.out.println(StringUtil.suffix("AAAA""A"));
    System.out.println(StringUtil.suffix("AAAA""B"));
  }

}
   

It gives the following output,
aaaaB
aaaaB
acaca
acac
AAAA
AAAAB


                    Print

   



Books Recommendation

 
 
bl  br