canRead

Returns true if a string starts with a particular sub string.

bool
canRead
(
Range
Stuff
)
(
ref Range range
,
Stuff stuff
)
if (
isInputRange!Range &&
isSomeChar!(ElementType!Range)
&&
(
isSomeChar!Stuff ||
isSomeString!Stuff
)
)

Examples

1 auto text0 = "{0}".dup;
2 assert(text0.canRead('{'));
3 auto text1 = "(* bla *)".dup;
4 assert(text1.canRead("(*"));
5 assert(text1 == "(* bla *)");
6 string text2 = "0x123456";
7 assert(!text2.canRead("0b"));

Meta