Re: convert string to wchar[]

2018-05-26 Thread Neia Neutuladh via Digitalmars-d-learn
On Saturday, 26 May 2018 at 17:12:38 UTC, Dr.No wrote: What's D's way to do that? I need it to be mutable array of wchar because a Windows function requires that. Alternative to go down to using pointers, which would be something like: wchar[] w = new wchar[s.length]; memcpy(w.ptr, s.ptr, s.

convert string to wchar[]

2018-05-26 Thread Dr.No via Digitalmars-d-learn
What's D's way to do that? I need it to be mutable array of wchar because a Windows function requires that. Alternative to go down to using pointers, which would be something like: wchar[] w = new wchar[s.length]; memcpy(w.ptr, s.ptr, s.length);

Re: Convert string to wchar.

2011-08-03 Thread Jacob Carlborg
On 2011-08-03 09:34, Pelle wrote: On Wed, 03 Aug 2011 08:29:09 +0200, Jacob Carlborg wrote: Yes, convert the first code point to a wchar and then throw if there's more the one character in the string. Not tested, and I might be wrong, but 'to!' should work between dchar and wchar, no? wchar

Re: Convert string to wchar.

2011-08-03 Thread Jacob Carlborg
On 2011-08-03 08:38, Jonathan M Davis wrote: On Wednesday 03 August 2011 08:29:09 Jacob Carlborg wrote: On 2011-08-02 19:51, Jonathan M Davis wrote: I tried to convert a string into a wchar, but that didn't compile because of this template constraint: https://github.com/D-Programming-Language/

Re: Convert string to wchar.

2011-08-03 Thread Jonathan M Davis
On Wednesday 03 August 2011 01:02:02 Jonathan M Davis wrote: > On Wednesday 03 August 2011 09:34:53 Pelle wrote: > > On Wed, 03 Aug 2011 08:29:09 +0200, Jacob Carlborg wrote: > > > Yes, convert the first code point to a wchar and then throw if > > > there's > > > more the one character in the stri

Re: Convert string to wchar.

2011-08-03 Thread Jonathan M Davis
On Wednesday 03 August 2011 09:34:53 Pelle wrote: > On Wed, 03 Aug 2011 08:29:09 +0200, Jacob Carlborg wrote: > > Yes, convert the first code point to a wchar and then throw if there's > > more the one character in the string. > > Not tested, and I might be wrong, but 'to!' should work between dc

Re: Convert string to wchar.

2011-08-03 Thread Pelle
On Wed, 03 Aug 2011 08:29:09 +0200, Jacob Carlborg wrote: Yes, convert the first code point to a wchar and then throw if there's more the one character in the string. Not tested, and I might be wrong, but 'to!' should work between dchar and wchar, no? wchar to_wchar(string s) { auto

Re: Convert string to wchar.

2011-08-02 Thread Jonathan M Davis
On Wednesday 03 August 2011 08:29:09 Jacob Carlborg wrote: > On 2011-08-02 19:51, Jonathan M Davis wrote: > >> I tried to convert a string into a wchar, but that didn't compile > >> because of this template constraint: > >> > >> https://github.com/D-Programming-Language/phobos/blob/master/std/conv

Re: Convert string to wchar.

2011-08-02 Thread Jacob Carlborg
On 2011-08-02 19:51, Jonathan M Davis wrote: I tried to convert a string into a wchar, but that didn't compile because of this template constraint: https://github.com/D-Programming-Language/phobos/blob/master/std/conv.d#L17 70 Is there a way to convert a string into a wchar? Does that even ma

Re: Convert string to wchar.

2011-08-02 Thread Jonathan M Davis
> I tried to convert a string into a wchar, but that didn't compile > because of this template constraint: > > https://github.com/D-Programming-Language/phobos/blob/master/std/conv.d#L17 > 70 > > Is there a way to convert a string into a wchar? Does that even make sense? What do you want it to d

Convert string to wchar.

2011-08-02 Thread Jacob Carlborg
I tried to convert a string into a wchar, but that didn't compile because of this template constraint: https://github.com/D-Programming-Language/phobos/blob/master/std/conv.d#L1770 Is there a way to convert a string into a wchar? -- /Jacob Carlborg