digitalmars.D - toString() for wchar*
- =?ISO-8859-1?Q?Julio_C=E9sar_Carrascal_Urquijo?= Apr 27 2004
- "Matthew" <matthew.hat stlsoft.dot.org> Apr 27 2004
- J Anderson <REMOVEanderson badmama.com.au> Apr 27 2004
- =?ISO-8859-1?Q?Julio_C=E9sar_Carrascal_Urquijo?= Apr 28 2004
May I suggest adding the following functions to Phobos? I'm using them
to convert strings from the Unicode versions of the Win32 API.
int strlen(wchar* s)
{
int len = 0;
wchar *c = &s[0];
while (*c++) ++len;
return len;
}
wchar[] toString(wchar* s)
{
return s ? s[0 .. strlen(s)] : cast(wchar[])null;
}
This functions were converted from their "char" equivalents in std.string.
Thanks.
--
Julio César Carrascal Urquijo
Apr 27 2004
int strlen(wchar* s) { int len = 0; wchar *c = &s[0]; while (*c++) ++len; return len; }
What's wrong with wcslen? Or, if you want an overload, int strlen(wchar *s) { return wcslen(s); } ?
Apr 27 2004
Matthew wrote:What's wrong with wcslen?
-- -Anderson: http://badmama.com.au/~anderson/
Apr 27 2004
Matthew wrote:What's wrong with wcslen? Or, if you want an overload, int strlen(wchar *s) { return wcslen(s); } ?
Didn't knew it existed! Well I just really need the toString for wchars: wchar[] toString(wchar* s) { return s ? s[0 .. wcslen(s)] : cast(wchar[])null; } -- Julio César Carrascal Urquijo
Apr 28 2004









J Anderson <REMOVEanderson badmama.com.au> 