string.toCharArray()

String.toCharArray() toCharArray to get char array of a string by using all chars as elements.

Returns an array.

Here are some examples with output.
String str = "Welcome to plus2net.com";
System.out.println(str); // display the input string
char my_array[]=str.toCharArray(); // create the array 
System.out.println(my_array[5]); // m
We will display all elements of the output array
String str = "plus2net";
char my_array[]=str.toCharArray();
for (int i=0; i<my_array.length;i++) {
System.out.println(my_array[i]);
}
Output
p
l
u
s
2
n
e
t


All String functions


plus2net.com



Post your comments , suggestion , error , requirements etc here




We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
©2000-2020 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer