digitalmars.D.learn - String conversion functions in Phobos
- simendsjo <simendsjo gmail.com> Aug 02 2011
- Jonathan M Davis <jmdavisProg gmx.com> Aug 02 2011
- simendsjo <simendsjo gmail.com> Aug 02 2011
- simendsjo <simendsjo gmail.com> Aug 02 2011
- Jonathan M Davis <jmdavisProg gmx.com> Aug 02 2011
- Jonathan M Davis <jmdavisProg gmx.com> Aug 02 2011
I want to convert SomeChar[] or SomeChar* into PerhapsAnotherCharNullTerminated*, but std.conv doesn't work like this. char[] a = "ao"; to!(wchar*)(a); // fails toUTF16z converts char[] to wchar* toStringz converts char[] to char* Am I missing function(s), or do I have to combine them myself?
Aug 02 2011
On Tuesday 02 August 2011 12:02:07 simendsjo wrote:I want to convert SomeChar[] or SomeChar* into PerhapsAnotherCharNullTerminated*, but std.conv doesn't work like this. char[] a = "ao"; to!(wchar*)(a); // fails toUTF16z converts char[] to wchar* toStringz converts char[] to char* Am I missing function(s), or do I have to combine them myself?
The github version has std.utf.toUTFz, but it obviously won't be in an actual release until the next release. - Jonathan M Davis
Aug 02 2011
On 02.08.2011 12:07, Jonathan M Davis wrote:The github version has std.utf.toUTFz
Thanks, I'll try that. What about the other way around? * to []?
Aug 02 2011
On 02.08.2011 12:27, Jonathan M Davis wrote:On Tuesday 02 August 2011 12:15:00 simendsjo wrote:On 02.08.2011 12:07, Jonathan M Davis wrote:The github version has std.utf.toUTFz
Thanks, I'll try that. What about the other way around? * to []?
I believe that it'll work with char* to string with std.conv.to, but I think that's it at the moment. Ideally, std.conv.to would do the conversions in both directions for all string types, but it doesn't do that yet. - Jonathan M Davis
toUTFz worked great. It's good to see how phobos are just doing-the-right-thing most of the time. Are * to [] planned for the next release?
Aug 02 2011
On Tuesday 02 August 2011 12:15:00 simendsjo wrote:On 02.08.2011 12:07, Jonathan M Davis wrote:The github version has std.utf.toUTFz
Thanks, I'll try that. What about the other way around? * to []?
I believe that it'll work with char* to string with std.conv.to, but I think that's it at the moment. Ideally, std.conv.to would do the conversions in both directions for all string types, but it doesn't do that yet. - Jonathan M Davis
Aug 02 2011
On Tuesday 02 August 2011 13:46:54 simendsjo wrote:On 02.08.2011 12:27, Jonathan M Davis wrote:On Tuesday 02 August 2011 12:15:00 simendsjo wrote:On 02.08.2011 12:07, Jonathan M Davis wrote:The github version has std.utf.toUTFz
Thanks, I'll try that. What about the other way around? * to []?
I believe that it'll work with char* to string with std.conv.to, but I think that's it at the moment. Ideally, std.conv.to would do the conversions in both directions for all string types, but it doesn't do that yet. - Jonathan M Davis
toUTFz worked great. It's good to see how phobos are just doing-the-right-thing most of the time. Are * to [] planned for the next release?
Maybe. Hopefully. It's on the todo list. I don't know when it'll get done. It's on my todo list assuming that no one else gets to it first, but depending on when the next release is and how fast I am at getting to it (and how hard it is to implement - I ran into serious issues the last time that I tried to mess with std.conv.to), it may or may not be in by the next release. - Jonathan M Davis
Aug 02 2011









simendsjo <simendsjo gmail.com> 