Open Wes0617 opened 8 years ago
Redundant maybe, but is that a good enough reason to drop it? Being able to specify an offset when finding an index is a common feature of string libraries.
In fact, I'd go so far as to say it's essential. It's not a deduplication trick, it's a means to specify where you are searching in a string. You need this when, for example, searching for multiple occurences of a string within a string. You could truncate the string each time, but this wastes memory and CPU time, and requires you to do arithmetic to find the position in the original string.
they are redundant with substring(). there are better ways to avoid unnecessary copies [stringbuilder is one, or interning], provided that we care of this kind of optimizations