Re: Problem with std.algorithm.iteration::substitute

2020-01-11 Thread Jesse Phillips via Digitalmars-d-learn
You can also turn your function into a fold. auto searches = ["1", "2"]; writeln (searches.fold!((a, b)  => a.substitute(b, "number").to!string)("come 1 come 2")) ;

Re: Problem with std.algorithm.iteration::substitute

2020-01-11 Thread Jesse Phillips via Digitalmars-d-learn
On Saturday, 11 January 2020 at 17:10:02 UTC, Martin Brezl wrote: Hi, i have a function like this: ``` import std.algorithm.iteration : substitute; //... string replace(string content, string[] searches , string replace) { if(searches.empty) return content; auto resul

Re: Problem with std.algorithm.iteration::substitute

2020-01-11 Thread Martin Brezl via Digitalmars-d-learn
On Saturday, 11 January 2020 at 17:10:02 UTC, Martin Brezl wrote: Hi, i have a function like this: ``` [...] auto result = content.substitute(searches.front,replace); for(size_t i=1; i < searches.length; i++) { searches.popFront(); result = result.substitu

Problem with std.algorithm.iteration::substitute

2020-01-11 Thread Martin Brezl via Digitalmars-d-learn
Hi, i have a function like this: ``` import std.algorithm.iteration : substitute; //... string replace(string content, string[] searches , string replace) { if(searches.empty) return content; auto result = content.substitute(searches.front,replace); for(size_t

Compilation error: undefined reference to 'cblas_dgemv' / 'cblas_dger' / 'cblas_dgemm'

2020-01-11 Thread p.shkadzko via Digitalmars-d-learn
I am trying to run example code from https://tour.dlang.org/tour/en/dub/lubeck example.d: --- /+dub.sdl: dependency "lubeck" version="~>1.1" +/ import lubeck: mtimes; import mir.algorithm.iteration: each; import mir.ndslice; import std.stdio: writeln; void main() { auto n = 5; // Magic

Re: Win32 Api: How create Open/"Save as" Dialog?

2020-01-11 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 11 January 2020 at 12:22:25 UTC, Marcone wrote: wchar[1024] szFileName = 0; ofn.lpstrFile = cast(LPWSTR) szFileName; You shouldn't cast there, just use `szFileName.ptr` instead. ofn.nMaxFile = MAX_PATH; and this should be the length of the array. It may require a ca

Re: How to parse epub content

2020-01-11 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 11 January 2020 at 12:38:38 UTC, Adnan wrote: How would someone approach parsing epub files in D? Is there any libraries to parse XHTML? I've done it before with my dom.d easily enough. The epub itself is a zip file. You might simply unzip it ahead of time, or use std.zip to acce

Re: How to parse epub content

2020-01-11 Thread JN via Digitalmars-d-learn
On Saturday, 11 January 2020 at 12:38:38 UTC, Adnan wrote: How would someone approach parsing epub files in D? Is there any libraries to parse XHTML? XHTML is XML. There are libraries to parse XML, from std.xml in the standard library to libraries like dxml in the package repository.

How to parse epub content

2020-01-11 Thread Adnan via Digitalmars-d-learn
How would someone approach parsing epub files in D? Is there any libraries to parse XHTML?

Re: Win32 Api: How create Open/"Save as" Dialog?

2020-01-11 Thread Marcone via Digitalmars-d-learn
On Friday, 10 January 2020 at 14:48:49 UTC, Marcone wrote: How create "Open" and "Save as" Dialog using "Win32 Api" and Dlang? Please send me a simple example code in Dlang. Thank you very much. Solution: import std; import core.sys.windows.windows; pragma(lib, "comdlg32"); // Function askop

Re: Win32 Api: How create Open/"Save as" Dialog?

2020-01-11 Thread John Chapman via Digitalmars-d-learn
On Saturday, 11 January 2020 at 10:34:34 UTC, Marcone wrote: This code works, but I can't get file Path. Someone can help me? import std; import core.sys.windows.windows; pragma(lib, "comdlg32"); void main(){ OPENFILENAME ofn; wchar* szFileName; You need to supply a buffer, not a poin

Re: Win32 Api: How create Open/"Save as" Dialog?

2020-01-11 Thread Marcone via Digitalmars-d-learn
On Friday, 10 January 2020 at 14:48:49 UTC, Marcone wrote: How create "Open" and "Save as" Dialog using "Win32 Api" and Dlang? Please send me a simple example code in Dlang. Thank you very much. This code works, but I can't get file Path. Someone can help me? import std; import core.sys.windo

Re: Win32 Api: How create Open/"Save as" Dialog?

2020-01-11 Thread Marcone via Digitalmars-d-learn
On Saturday, 11 January 2020 at 00:12:03 UTC, René Heldmaier wrote: On Friday, 10 January 2020 at 14:48:49 UTC, Marcone wrote: How create "Open" and "Save as" Dialog using "Win32 Api" and Dlang? Please send me a simple example code in Dlang. Thank you very much. Have a look at this website:

Re: Win32 Api: How create Open/"Save as" Dialog?

2020-01-11 Thread Marcone via Digitalmars-d-learn
On Friday, 10 January 2020 at 15:44:53 UTC, Mike Parker wrote: On Friday, 10 January 2020 at 15:06:07 UTC, Marcone wrote: Very complicated. Can you send me the simple clear code? https://docs.microsoft.com/en-us/windows/win32/dlgbox/using-common-dialog-boxes Not compile in Dlang.