Use as_bytes() for string indexing.

Recent rustc nightly (rust-lang/rust#15085) removed support for indexing `&str` objects. `as_bytes()` is a zero-cost view of the underlying array.