Java examples for java.lang:StringBuilder
StringBuilder trim
//package com.java2s; public class Main { public static void main(String[] argv) throws Exception { StringBuilder builder = new StringBuilder(); trim(builder);/*w ww.ja va2s. co m*/ } public static void trim(StringBuilder builder) { if (builder == null) { throw new NullPointerException(); } while ((builder.length() > 0) && (Character.isWhitespace(builder.charAt(0)))) { builder.deleteCharAt(0); } while ((builder.length() > 0) && (Character .isWhitespace(builder.charAt(builder.length() - 1)))) { builder.deleteCharAt(builder.length() - 1); } } }