s.substr(0,p)
The first argument is the starting position; the second is the length. If you omit the length, you get the longest possible substring with the given starting position, which is why s.substr(p+1)
works.
Sodabread commented: Nice solution =) +1
Ancient Dragon commented: Very nice and efficient +33
arkoenig 340 Practically a Master Poster
arkoenig 340 Practically a Master Poster