JuliaLang/julia — pull request #7770 by catawbasam (2014-07-29 04:49:22+00:00)
Title: faster isvalid(SubString,i)

Replaces the closed pull request #7744, which specialized isvalid on SubString{UTF8String}.

This version, based on @ivarne 's proposed alternative is more general, covering all SubStrings.
It runs faster on Linux, and much faster on Windows, because it avoids use of try/except in most cases.