On Friday, 28 March 2014 at 15:33:32 UTC, Gary Miller wrote:
If I need to examine a byte in string for a specific ASCII value like

string MyString;

MyString = "Hello World"

and I want to check a position in the string for a certain unprintable ASCII value like the ASCII Block 219 what is the recommended method for doing so

if (MyString[0..1])== ???(219)) writeln("ASCII Block found")

I know there's and easy lib function or cast somewhere but everywhere I've looked it's not jumping out at me.

219 is not an "ASCII Block". You can just do a search for 219 in your *byte* stream:

auto b = ("hello" ~ cast(char)219 ~ "world").representation.canFind(219);

The "representation" part *very* is important: Without it, you string will be interpreted as unicode, and there is *not* actually a 219 codepoint in there.

Reply via email to