does string count start from zero in python,php,javascript and java | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 7

does string count start from zero in python,php,javascript and java

2nd Feb 2019, 12:00 PM
ᎯᏰᏰᎯ__ᏥᎿᏩ➰
ᎯᏰᏰᎯ__ᏥᎿᏩ➰ - avatar
7 Answers
+ 7
yeah thank you very much
2nd Feb 2019, 2:04 PM
ᎯᏰᏰᎯ__ᏥᎿᏩ➰
ᎯᏰᏰᎯ__ᏥᎿᏩ➰ - avatar
+ 6
okay what about their length not index
2nd Feb 2019, 1:40 PM
ᎯᏰᏰᎯ__ᏥᎿᏩ➰
ᎯᏰᏰᎯ__ᏥᎿᏩ➰ - avatar
+ 3
String index starts with 0 but length start with 1. Let say -------length->12345678 echo strlen("abba_ktg"); --------index->01234567 /*Here string index is 0-7 but length count start by using value 1*/ Output:- 8 I hope your doubt will be cleared😊
2nd Feb 2019, 2:02 PM
Puneet
+ 3
My pleasure😊
2nd Feb 2019, 2:09 PM
Puneet
+ 2
Yes
2nd Feb 2019, 1:38 PM
Puneet
+ 2
Nope.. it counts from 1.. While the index starts from 0
30th Jun 2019, 8:08 AM
Isaac Frank
Isaac Frank - avatar
+ 1
Yes the indexing starts from 0 at the beginning and -1 at the end
17th Feb 2019, 8:22 PM
Chris Barranger
Chris Barranger - avatar