Here you can find the source of toCharArray(String s)
Parameter | Description |
---|---|
s | the string to be converted. |
public static char[] toCharArray(String s)
//package com.java2s; /* /* ww w .j ava 2s. com*/ * Copyright(c) 2005 Center for E-Commerce Infrastructure Development, The * University of Hong Kong (HKU). All Rights Reserved. * * This software is licensed under the GNU GENERAL PUBLIC LICENSE Version 2.0 [1] * * [1] http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt */ public class Main { /** * Converts the given string into an array of characters. * * @param s the string to be converted. * @return an array of characters representing the given string or * an empty array if the given string is null or empty. */ public static char[] toCharArray(String s) { return s == null ? new char[] {} : s.toCharArray(); } }