char at code example
Example 1: js for each character in string
for (var i = 0; i < str.length; i++) {
alert(str.charAt(i));
}
Example 2: get certain character from string java
String words = "Hi There";
char index = words.charAt(0);
System.out.println(index);
Example 3: character at index of string java
String str = "Grepper";
char ch = str.charAt(0);
Example 4: javascript charat
myString = "Hello World!";
console.log(myString.charAt(0));
console.log(myString.charAt(5));
console.log(myString.charAt(8));
console.log(myString.charAt(23));
Example 5: string char at java
char ch=name.charAt(4);
Example 6: char.at java
public class EsempioCharat {
public static void main(String args[]) {
String str = "informaticappunti.it";
char ch1 = str.charAt(0);
char ch2 = str.charAt(5);
System.out.println("Il carattere all'indice 0 è: "+ch1);
System.out.println(" Il carattere all'indice 5 è: "+ch2);
}
}