+ 2

[SOLVED]what does length()==7 mean?

I'm new thanks for helping me 😊

16th Jun 2020, 9:17 AM
hamid
hamid - avatar
10 odpowiedzi
+ 5
Ok, so a.length is exactly what it looks like - the length of a string. In other words, it's a number of characters that the string contains.
16th Jun 2020, 10:06 AM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 3
hamid It doesn't. It just returns the length. You have to use some other function to check for the number of occurrences.
16th Jun 2020, 10:26 AM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 3
I am not really sure if there is a .count method in Java just like that. But you can use the following - while iterating through the string, try to find a difference between a.length() and a.replace(<char>, "").length()
16th Jun 2020, 10:56 AM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 2
Kuba Siekierzyński I wanted to know how it distinguishes a character is repeating ?
16th Jun 2020, 10:16 AM
hamid
hamid - avatar
+ 2
Kuba Siekierzyński That's right thanks for that I should pay more attention. but which method will distinguishe characters repetition??
16th Jun 2020, 10:32 AM
hamid
hamid - avatar
+ 1
hamid Please be more specific. It could mean anything.
16th Jun 2020, 9:47 AM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
0
thank you so much 👍
16th Jun 2020, 12:22 PM
hamid
hamid - avatar
0
thanks
17th Jun 2020, 7:39 AM
Danish
0
html / js : htmlElement.length
17th Jun 2020, 3:32 PM
Sali65
Sali65 - avatar