Best way to add slash to tail of the path

Daniel Kozak via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Nov 27 12:50:56 PST 2014


Dne Thu, 27 Nov 2014 21:20:24 +0100 Suliman via Digitalmars-d-learn  
<digitalmars-d-learn at puremagic.com> napsal(a):

>> take a second look then. ;-) you'll find `buildPath()` here too.
> Not better:
>
> 	string foo = "D:/code/txtDownloader";
>
> 	writeln(foo);
> 	foo = foo.buildPath;
> 	foo ~= "config.txt";
> 	writeln(foo);
>
>
> Running .\txtdownloader.exe
> D:/code/txtDownloader
> D:/code/txtDownloaderconfig.txt <-- need:  
> D:/code/txtDownloader/config.txt
>
>

what about:

         string foo = "D:/code/txtDownloader";
  	writeln(foo);
  	foo = buildPath(foo, "config.txt");
  	writeln(foo);


More information about the Digitalmars-d-learn mailing list