Update String.indexOf/lastIndexOf to match as3

The C# string functions throw exceptions for cases that as3 allows, so
we need to massage the input before invoking them.