Java examples for java.lang:String Whitespace
remove All Next Space in StringBuilder
//package com.java2s; public class Main { public static void removeAllNextSpace(StringBuilder val, int startInd) { int endInd = getFirstNonSpaceInd(val, startInd); val.delete(startInd, endInd); }/* w ww .j ava 2 s . c o m*/ public static int getFirstNonSpaceInd(CharSequence val, int startInd) { int res = startInd; while (val.length() > res) { char c = val.charAt(res); if (!Character.isSpaceChar(c) && !Character.isWhitespace(c)) break; ++res; } return res; } public static int getFirstNonSpaceInd(CharSequence val) { return getFirstNonSpaceInd(val, 0); } }