Java Char Array Create toCharArray(CharSequence charSequence)

Here you can find the source of toCharArray(CharSequence charSequence)

Description

Converts a CharSequence into a char [] array.

License

Open Source License

Declaration

public static char[] toCharArray(CharSequence charSequence) 

Method Source Code

//package com.java2s;
/*/*from  www . j  a  v  a2  s . c o  m*/
 * Carrot2 project.
 *
 * Copyright (C) 2002-2016, Dawid Weiss, Stanis?aw Osi?ski.
 * All rights reserved.
 *
 * Refer to the full license file "carrot2.LICENSE"
 * in the root folder of the repository checkout or at:
 * http://www.carrot2.org/carrot2.LICENSE
 */

public class Main {
    /**
     * Converts a {@link CharSequence} into a <code>char []</code> array.
     */
    public static char[] toCharArray(CharSequence charSequence) {
        char[] array = new char[charSequence.length()];
        for (int i = 0; i < charSequence.length(); i++) {
            array[i] = charSequence.charAt(i);
        }
        return array;
    }
}

Related

  1. toCharArray(byte[] data)
  2. toCharArray(byte[] input)
  3. toCharArray(byte[] src)
  4. toCharArray(char... values)
  5. toCharArray(CharSequence chars)
  6. toCharArray(CharSequence charSequence)
  7. toCharArray(CharSequence cs)
  8. toCharArray(double[][] array)
  9. toCharArray(final byte[] array)