Android String Search skipSpaces(String s, int start)

Here you can find the source of skipSpaces(String s, int start)

Description

Skips any spaces at or after start and returns the index of first non-space character;

License

Open Source License

Parameter

Parameter Description
s the string
start index to start

Return

index of first non-space

Declaration

public static int skipSpaces(String s, int start) 

Method Source Code

//package com.java2s;

public class Main {
    /**/* ww w  .  ja  v  a2  s . c  o m*/
     * Skips any spaces at or after start and returns the index of first
     * non-space character;
     * @param s the string
     * @param start index to start
     * @return index of first non-space
     */
    public static int skipSpaces(String s, int start) {

        int limit = s.length();
        int i = start;

        for (; i < limit; i++) {
            if (s.charAt(i) != ' ') {
                break;
            }
        }

        return i;
    }
}

Related

  1. safeIndexOf(String s, String search)
  2. indexOf(String str, String searchStr)
  3. nestedIndexOf(final String s, final int startPos, final String open, final String close)
  4. findFirstNotOf(String str, String chars)
  5. findFirstOf(String str, String chars)
  6. findLastNotOf(String str, String chars)