digitalmars.D - toString() for wchar*
- =?ISO-8859-1?Q?Julio_C=E9sar_Carrascal_Urquijo?= (17/17) Apr 27 2004 May I suggest adding the following functions to Phobos? I'm using them
- Matthew (7/14) Apr 27 2004 What's wrong with wcslen?
-
J Anderson
(4/6)
Apr 27 2004
Obviously wcslen is not obvious
- =?ISO-8859-1?Q?Julio_C=E9sar_Carrascal_Urquijo?= (8/19) Apr 28 2004 Didn't knew it existed! Well I just really need the toString for wchars:
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?Obviously wcslen is not obvious <g> -- -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> 