Java examples for java.lang:String Index
get First Non Space Index
//package com.java2s; public class Main { public static void main(String[] argv) { CharSequence val = "java2s.com"; System.out.println(getFirstNonSpaceInd(val)); }//from ww w . j a v a 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); } }