Re: probably a trivial question...

2022-10-13 Thread rassoc via Digitalmars-d-learn
On 10/14/22 01:43, WhatMeWorry via Digitalmars-d-learn wrote: Does D provide any guidance as to what is preferred or are they identical for all intents and purposes? You won't see a difference for this specific example since the split function supports character, string and even range separat

Re: probably a trivial question...

2022-10-13 Thread Ali Çehreli via Digitalmars-d-learn
Changing the order of lines... On 10/13/22 16:43, WhatMeWorry wrote: > return s.split(';'); // single quotes That one is a single character and very lightweigth because it's just an integral value. You can't put more than one character within single quotes: ';x' // ERROR > return s.split(

probably a trivial question...

2022-10-13 Thread WhatMeWorry via Digitalmars-d-learn
I was a little (nicely) surprised that I could use double quotes, single quotes, or back ticks in the following line of code. return s.split(";"); // double quotes or return s.split(';'); // single quotes or return s.split(`;`); // back ticks Does D provide any guidance as to what is pref

Re: Float rounding (in JSON)

2022-10-13 Thread Sergey via Digitalmars-d-learn
On Thursday, 13 October 2022 at 19:27:22 UTC, Steven Schveighoffer wrote: Thank you Steven, for your very detailed answer. It doesn't look really that far off. You can't expect floating point parsing to be exact, as floating point does not perfectly represent decimal numbers, especially when

Re: Float rounding (in JSON)

2022-10-13 Thread Steven Schveighoffer via Digitalmars-d-learn
On 10/13/22 3:00 PM, Sergey wrote: I'm not a professional of IEEE 754, but just found this behavior at rounding in comparison with other languages. I supose it happened because in D float numbers parsed as double and have a full length of double while rounding. But this is just doesn't match wi

Float rounding (in JSON)

2022-10-13 Thread Sergey via Digitalmars-d-learn
I'm not a professional of IEEE 754, but just found this behavior at rounding in comparison with other languages. I supose it happened because in D float numbers parsed as double and have a full length of double while rounding. But this is just doesn't match with behavior in other languages. I

Re: Replacing tango.text.Ascii.isearch

2022-10-13 Thread Patrick Schluter via Digitalmars-d-learn
On Thursday, 13 October 2022 at 08:27:17 UTC, bauss wrote: On Wednesday, 5 October 2022 at 17:29:25 UTC, Steven Schveighoffer wrote: On 10/5/22 12:59 PM, torhu wrote: I need a case-insensitive check to see if a string contains another string for a "quick filter" feature. It should preferrably

Re: Replacing tango.text.Ascii.isearch

2022-10-13 Thread rikki cattermole via Digitalmars-d-learn
On 13/10/2022 9:55 PM, bauss wrote: Yeah, text isn't easy :D Indeed! It has me a bit concerned actually, I'm wondering if my string stuff will even work correctly for UI's due to performance issues. My string builder for instance allocates like crazy just to do slicing. But hey, at least I

Re: Replacing tango.text.Ascii.isearch

2022-10-13 Thread bauss via Digitalmars-d-learn
On Thursday, 13 October 2022 at 08:48:49 UTC, rikki cattermole wrote: On 13/10/2022 9:42 PM, bauss wrote: Oh and to add onto this, IFF you have to do it the hacky way, then converting to uppercase instead of lowercase should be preferred, because not all lowercase characters can perform round

Re: Replacing tango.text.Ascii.isearch

2022-10-13 Thread rikki cattermole via Digitalmars-d-learn
On 13/10/2022 9:42 PM, bauss wrote: Oh and to add onto this, IFF you have to do it the hacky way, then converting to uppercase instead of lowercase should be preferred, because not all lowercase characters can perform round trip, although a small group of characters, then using uppercase fixes

Re: Replacing tango.text.Ascii.isearch

2022-10-13 Thread bauss via Digitalmars-d-learn
On Thursday, 13 October 2022 at 08:35:50 UTC, bauss wrote: On Thursday, 13 October 2022 at 08:30:04 UTC, rikki cattermole wrote: On 13/10/2022 9:27 PM, bauss wrote: This doesn't actually work properly in all languages. It will probably work in most, but it's not entirely correct. Ex. Turkish

Re: Replacing tango.text.Ascii.isearch

2022-10-13 Thread bauss via Digitalmars-d-learn
On Thursday, 13 October 2022 at 08:30:04 UTC, rikki cattermole wrote: On 13/10/2022 9:27 PM, bauss wrote: This doesn't actually work properly in all languages. It will probably work in most, but it's not entirely correct. Ex. Turkish will not work with it properly. Very interesting article:

Re: Replacing tango.text.Ascii.isearch

2022-10-13 Thread rikki cattermole via Digitalmars-d-learn
On 13/10/2022 9:27 PM, bauss wrote: This doesn't actually work properly in all languages. It will probably work in most, but it's not entirely correct. Ex. Turkish will not work with it properly. Very interesting article: http://www.moserware.com/2008/02/does-your-code-pass-turkey-test.html

Re: Replacing tango.text.Ascii.isearch

2022-10-13 Thread bauss via Digitalmars-d-learn
On Wednesday, 5 October 2022 at 17:29:25 UTC, Steven Schveighoffer wrote: On 10/5/22 12:59 PM, torhu wrote: I need a case-insensitive check to see if a string contains another string for a "quick filter" feature. It should preferrably be perceived as instant by the user, and needs to check a f