User Tools

Site Tools


Sidebar

Programming Reference/Librarys

Question & Answer

Q&A is closed







java:lang:string:toarray

toCharArray

public char[] toCharArray()

description of toCharArray()

converts a string to a new character array

example of toCharArray in java

package codereferececomjava;
 
public class CodeRefereceComJava {
 
 
    public static void main(String[] args) {
        String str = "some Text";
        char[] text;
 
 
        System.out.println(str); // print the String
 
        text = str.toCharArray();
        for (int i = 0; i <= text.length - 1; i++) {
 
        System.out.println(text[i]); // print the content of text Array
 
        }
    }
}

output of toCharArray in java

  some Text
  s
  o
  m
  e
   
  T
  e
  x
  t
 
advertising
java/lang/string/toarray.txt · Last modified: 2013/04/18 08:50 by 88.74.75.6

Impressum Datenschutz