why not use JString::substr() for this?

if (extension_loaded('mbstring')) ...