+ 2
Length of string in java
How to find length of string without using length
5 Respuestas
+ 6
But what is the whole point especially since the length method is just so useful and reduces code length.
+ 5
You can use an enhanced for loop:
String str = "This is a string";
int len = 0;
for (String i: str.split("")
len++;
System.out.println(len);
+ 1
Prometheus ¯\_(ツ)_/¯ 🇸🇬 Maybe practice purpose.
+ 1
, you can use infinite loop i++ index and catch index error. too
or stream of chars and count()
0
Complete the code to create a string containing a double quote