Re: Create a case-insensitive startsWith

2015-04-30 Thread Justin Whear via Digitalmars-d-learn
Note that my solution relies on the pre-release version of std.uni, those lazy functions aren't in the latest release.

Re: Create a case-insensitive startsWith

2015-04-29 Thread PhilipDaniels via Digitalmars-d-learn
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

Re: Create a case-insensitive startsWith

2015-04-29 Thread Robert burner Schadek via Digitalmars-d-learn
if(0X.std.string.indexOf(0x, CaseSensitive.no) == 0) should work

Re: Create a case-insensitive startsWith

2015-04-28 Thread Justin Whear via Digitalmars-d-learn
On Tue, 28 Apr 2015 21:45:07 +, PhilipDaniels wrote: Beginner question. Given if (startsWith(input, 0x, 0X)) How do I turn that into a case-insensitive startsWith? startsWith says it takes a predicate but I can't figure out how to pass it one. The examples all use a == b !? These

Re: Create a case-insensitive startsWith

2015-04-28 Thread weaselcat via Digitalmars-d-learn
On Tuesday, 28 April 2015 at 21:45:10 UTC, PhilipDaniels wrote: Beginner question. Given if (startsWith(input, 0x, 0X)) How do I turn that into a case-insensitive startsWith? startsWith says it takes a predicate but I can't figure out how to pass it one. The examples all use a == b !?

Create a case-insensitive startsWith

2015-04-28 Thread PhilipDaniels via Digitalmars-d-learn
Beginner question. Given if (startsWith(input, 0x, 0X)) How do I turn that into a case-insensitive startsWith? startsWith says it takes a predicate but I can't figure out how to pass it one. The examples all use a == b !? These attempts below, and other things I have tried, fail with