Java Char Array to Char charAt(CharSequence chars, int i)

Here you can find the source of charAt(CharSequence chars, int i)

Description

Convenience for peeking at a character which might be beyond the end of the sequence.

License

Open Source License

Parameter

Parameter Description
chars a parameter
i a parameter

Return

the char at index i, if within range, or 0 otherwise.

Declaration

public static char charAt(CharSequence chars, int i) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**/*w w w. j a v a2  s  .  c  om*/
     * Convenience for peeking at a character which might be beyond the end of
     * the sequence.
     * 
     * @param chars
     * @param i
     * @return the char at index i, if within range, or 0 otherwise.
     */
    public static char charAt(CharSequence chars, int i) {
        return i < chars.length() ? chars.charAt(i) : 0;
    }
}

Related

  1. charArrayToLowerCase(char[] arr)
  2. charAt(char[] s, int pos)
  3. charAt(CharSequence chars, int index, boolean ignoreCase)
  4. hasCharAt(char toLookFor, int position, char[] toSearch)