Re: String Prefix Predicate

2014-08-19 Thread monarch_dodra via Digitalmars-d-learn
On Monday, 18 August 2014 at 20:50:55 UTC, Nordlöw wrote: On Monday, 18 August 2014 at 12:42:25 UTC, monarch_dodra wrote: If you are using a string, the only thing helpful in there is `byCodeunit`. The rest is only useful if you have actual ranges. Actual ranges of...characters and strings?

Re: String Prefix Predicate

2014-08-19 Thread Nordlöw
On Tuesday, 19 August 2014 at 08:23:53 UTC, monarch_dodra wrote: You could define your own range of chars, for example, a rope. Or, you want to store your string in a deterministic container (Array!char). These would produce individual code units, but you'd still need them to be interpreted

Re: String Prefix Predicate

2014-08-18 Thread Nordlöw
On Saturday, 16 August 2014 at 20:59:47 UTC, monarch_dodra wrote: I don't get it? If you use byDchar, you are *explicitly* decoding. How is that any better? If anything, you are *preventing* the (many) opportunities phobos has to *avoid* decoding when it can... byDchar and alikes are lazy

Re: String Prefix Predicate

2014-08-18 Thread monarch_dodra via Digitalmars-d-learn
On Monday, 18 August 2014 at 11:28:25 UTC, Nordlöw wrote: On Saturday, 16 August 2014 at 20:59:47 UTC, monarch_dodra wrote: I don't get it? If you use byDchar, you are *explicitly* decoding. How is that any better? If anything, you are *preventing* the (many) opportunities phobos has to

Re: String Prefix Predicate

2014-08-18 Thread Nordlöw
On Monday, 18 August 2014 at 12:42:25 UTC, monarch_dodra wrote: On Monday, 18 August 2014 at 11:28:25 UTC, Nordlöw wrote: On Saturday, 16 August 2014 at 20:59:47 UTC, monarch_dodra wrote: I don't get it? If you use byDchar, you are *explicitly* decoding. How is that any better? If anything,

Re: String Prefix Predicate

2014-08-16 Thread monarch_dodra via Digitalmars-d-learn
On Thursday, 14 August 2014 at 17:41:08 UTC, Nordlöw wrote: On Thursday, 14 August 2014 at 17:33:41 UTC, Justin Whear wrote: std.algorithm.startsWith? Should auto-decode, so it'll do a What about https://github.com/D-Programming-Language/phobos/pull/2043 Auto-decoding should be avoided

Re: String Prefix Predicate

2014-08-16 Thread monarch_dodra via Digitalmars-d-learn
On Saturday, 16 August 2014 at 20:59:47 UTC, monarch_dodra wrote: If anything, you are *preventing* the (many) opportunities phobos has to *avoid* decoding when it can... By that I want to stress what Jonathan M Davis said Unless the string types match, there's no way around it. You should

Re: String Prefix Predicate

2014-08-14 Thread Justin Whear via Digitalmars-d-learn
On Thu, 14 Aug 2014 17:17:11 +, Nordlöw wrote: What's the preferrred way to check if a string starts with another string if the string is a 1. string (utf-8) BiDir 2. wstring (utf-16) BiDir 3. dstring (utf-32) Random std.algorithm.startsWith? Should auto-decode, so it'll do a utf-32

Re: String Prefix Predicate

2014-08-14 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, 14 August 2014 at 17:41:08 UTC, Nordlöw wrote: On Thursday, 14 August 2014 at 17:33:41 UTC, Justin Whear wrote: std.algorithm.startsWith? Should auto-decode, so it'll do a What about https://github.com/D-Programming-Language/phobos/pull/2043 Auto-decoding should be avoided