Strings::substring(): avoid calculating string length unless necessary

Minor optimization. I originally wanted to call `self::length` only when `mb_substr` is not available but as it turned out, `mb_substr` also does not handles this well in PHP < 5.4.8.
I'll change length() to use mb_strlen() is available. For some reason urldecode is slower since 5.4.0.