tl  tr
  Home | Tutorials | Articles | Videos | Products | Tools | Search
Interviews | Open Source | Tag Cloud | Follow Us | Bookmark | Contact   
 Tools and Libs > Ostermiller Utilities > String Trim Chars

String Trim Chars 

Ostermiller Java Utilities contain various components such as CSV parsing, Base64 Encoding, MD5 digest, String and Exec Helper classes. This requires the library ostermillerutils-1.08.01.jar to be in classpath. The following example shows using StringHelper.trim() API. It trims the specified characters from the beginning and end of the given string.

File Name  :  
com/bethecoder/tutorials/ostermillerutils/StringTrimCharsTest.java 
Author  :  Sudhakar KV
Email  :  [email protected]
   
package com.bethecoder.tutorials.ostermillerutils;

import java.io.IOException;

import com.Ostermiller.util.StringHelper;

public class StringTrimCharsTest {

  /**
   @param args
   @throws IOException 
   */
  public static void main(String[] argsthrows IOException {

    String str = StringHelper.trim("+  1234.56 INR."" .+INR");
    System.out.println(str);
    
    str = StringHelper.trim("=== JAVA ==="" =");
    System.out.println(str);
    
    str = StringHelper.trim("*+=== ABCD1123411DCBA ===+""1 =*+ADBC");
    System.out.println(str);
  }

}
   

It gives the following output,
1234.56
JAVA
234



 
  


  
bl  br