// Find a ']' in a buffer of 1024 bytes using an additional sentinel. size_t length = 1024; char[] buffer = new char[](length+1); buffer[length] = ']'; auto pos = buffer.ptr.find!("=]"); if (pos < length) { // was an actual find before the sentinel }
Same as the overload for strings, but with only a char*, making it faster as it cannot do a boundary check.
Sometimes when looking for a character it is helpful to append it as a sentinel to the char buffer and then use this function instead of the slower one that checks the boundary constantly.