V2 string

Walter Bright newshound1 at digitalmars.com
Thu Jul 5 01:06:45 PDT 2007


Derek Parnell wrote:
> However, if I might need to update it ...
> 
>    char[] fullpath;
> 
>    fullpath = CanonicalPath(shortname).dup;
>    version(Windows)
>    {
>       setLowerCase(fullpath);
>    }
> 
> The point is that the 'CanonicalPath' function hasn't got a clue what the
> calling function is intending to do with the result so it is trying to be
> responsible by guarding it against mistakes by the caller.

If you write it like this:

string fullpath;

fullpath = CanonicalPath(shortname);
version(Windows)
{
       fullpath = std.string.tolower(fullpath);
}

you won't need to do the .dup .



More information about the Digitalmars-d mailing list