|
|||
|
Hi Guys,
Im a 2nd year IT student doing my bachelors degree in New Zealand. So I was wondering... is there something in Java that works like StringTokinizer but divides a sentence into characters? I know its possible I just dont know how. I basically want to try and make and encoder that encodes normal .txt documents. Thanks! |
|
|||
|
Hi, welcome to the forums!
This is one way to do it: Java Code:
public class CharDemo {
public static void main(String[] args){
String sentence = "This is a sentence";
char[] charSentence = sentence.toCharArray();
for(int i = 0; i < sentence.length(); i++){
System.out.print(charSentence[i]);
}
}
}
|
|
|||
|
Sure, np
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|