Here you can find the source of powerTrim(String s)
public static String powerTrim(String s)
//package com.java2s; //License from project: Apache License public class Main { public static String powerTrim(String s) { return s.replaceAll("^\\W+", "").replaceAll("\\W+$", ""); }/* w ww . j a v a2 s. c o m*/ }