Updated String Category (grammatical updates and specifications).md (#33779)
* Update index.md Updated descriptions for the String category, specified that strings are objects. Corrected grammatical error. * Update index.md
This commit is contained in:
committed by
The Coding Aviator
parent
7cbde1d724
commit
0cb6c25d84
@ -168,7 +168,7 @@ class demo{
|
||||
|
||||
## String:
|
||||
|
||||
String is not a primitive data type, but it lets you store multiple character data types in an array and has many methods that can be used. It is used quite commonly when the user types in data and you have to manipulate it.
|
||||
String is not a primitive data type, it is an object, but it lets you store multiple character data types in an array and has many methods that can be used. It is used quite commonly when the user types in data and needs to manipulate it later on.
|
||||
|
||||
In the example below, we try to remove all of the letters from the string and output it:
|
||||
|
||||
@ -182,7 +182,7 @@ for(int i=0;i<input.length();i++){
|
||||
//if the character at index i on the string is a letter or a space, move on to the next index
|
||||
if(Character.isLetter(input.charAt(i)) || input.charAt(i)==' '){
|
||||
|
||||
continue;
|
||||
continue; // Skips to the next iteration of the for loop
|
||||
}
|
||||
|
||||
output = output + input.charAt(i); //the number is added onto the output
|
||||
|
Reference in New Issue
Block a user