On Tuesday, 28 April 2015 at 22:34:07 UTC, Justin Whear wrote:
if (startsWith!"icmp(a, b) == 0"(input, "0x"))
if (startsWith!"std.uni.icmp(a, b) == 0"(input, "0x"))
if (startsWith!((a,b) => icmp(a,b) == 0)(input, "0x"))
The issue is that those icmp functions take strings as
arguments while
startsWith expects the predicate to take individual characters.
Thanks. That seems obvious now that you mention it but honestly I
could not tell that from the documentation :-(
I believe the best solution here is to use the lazy toLowerCase
function
in std.uni and the default predicate:
if (startsWith(input.toLowerCase, "0x".toLowerCase))
I think I will have to make a "string idioms" wiki page...