Regex split ignoore empty and whitespace

2020-02-20 Thread AlphaPurned via Digitalmars-d-learn
std.regex.split(l, ctRegex!`[\s-\)\(\.]`); I'm trying too split a string on spaces and stuff... but it is returning empty strings and other matches(e.g., ()). I realize I can delete afterwards but is there a direct way from split or ctRegex?

Re: Two problems with json and lcd

2020-02-19 Thread AlphaPurned via Digitalmars-d-learn
On Wednesday, 19 February 2020 at 08:47:04 UTC, Petar Kirov [ZombineDev] wrote: On Wednesday, 19 February 2020 at 08:14:34 UTC, AlphaPurned wrote: The first is std.json. It is broke. Doesn't work with tuples. The change above fixes it by treating tuple as an array(same code). It works fine.

Re: Two problems with json and lcd

2020-02-19 Thread AlphaPurned via Digitalmars-d-learn
On Tuesday, 18 February 2020 at 22:00:25 UTC, Petar Kirov [ZombineDev] wrote: On Tuesday, 18 February 2020 at 18:05:43 UTC, AlphaPurned wrote: json has two issues, it doesn't work with tuple: (isArray!T) goes to (isArray!T || (T.stringof.length > 4 && T.stringof[0..5] == "Tuple")) and righ

Two problems with json and lcd

2020-02-18 Thread AlphaPurned via Digitalmars-d-learn
json has two issues, it doesn't work with tuple: (isArray!T) goes to (isArray!T || (T.stringof.length > 4 && T.stringof[0..5] == "Tuple")) and right below else { static assert(false, text(`unable to convert type "`, T.Stringof, `" to json`)); } and it

Re: AA code 50x slower

2020-02-16 Thread AlphaPurned via Digitalmars-d-learn
On Sunday, 16 February 2020 at 13:50:49 UTC, evilrat wrote: On Sunday, 16 February 2020 at 12:57:43 UTC, AlphaPurned wrote: template AA(string[] S) { auto _do() { int[string] d; foreach(s; S) d[s] = 0; return d; } enum AA = _do; } My best guess is that enum arrays(except strings) a

AA code 50x slower

2020-02-16 Thread AlphaPurned via Digitalmars-d-learn
template AA(string[] S) { auto _do() { int[string] d; foreach(s; S) d[s] = 0; return d; } enum AA = _do; } if (t in AA!(["a", "and", "mp4", "mp3", "the", "with", "live", "no", "&", "of", "band"])) continue; The if statement literally causes a 50x slow down of the code. (LD

Re: How the hell to split multiple delims?

2020-02-16 Thread AlphaPurned via Digitalmars-d-learn
On Saturday, 15 February 2020 at 14:35:59 UTC, Steven Schveighoffer wrote: On 2/15/20 6:32 AM, AlphaPurned wrote: I've tried 10 different ways with split and splitter, I've used all the stuff that people have said online but nothing works. I always get a template mismatch error. Why is someth

How the hell to split multiple delims?

2020-02-15 Thread AlphaPurned via Digitalmars-d-learn
I've tried 10 different ways with split and splitter, I've used all the stuff that people have said online but nothing works. I always get a template mismatch error. Why is something so easy to do so hard in D? auto toks = std.regex.split(l, Regex("s")); auto toks = std.regex.splitter(l, Regex

range code doesn't work for multi-array

2019-12-16 Thread AlphaPurned via Digitalmars-d-learn
if arr is a single array the follow code works(removing [i]) but if it is a double array it fails. arr as type double[A][B]. arr[i] has type double[A]. v ~= arr[i].map!(a=>to!string(a)~",").join; with `Range = double[21]` must satisfy the following constraint: ` isInputRange!(Unqua

D in Unity or Unreal?

2019-11-13 Thread AlphaPurned via Digitalmars-d-learn
Anyone use such things effectively?