in reply to finding the last occurence of substring in string
Just for the sake of TIMTOWTDI (or fun, or for following Matthew 20:16), you may apply the following algorithm:
- get the index of the reversed substring in the reversed string
- calculate the position (lengthOfString minus index minus lengthOfSubstring)(with a possible off-by-one-correction)
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: finding the last occurence of substring in string
by RichardK (Parson) on Jul 27, 2012 at 10:20 UTC |
In Section
Seekers of Perl Wisdom