Best way to add slash to tail of the path

ketmar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Nov 27 10:11:58 PST 2014


On Thu, 27 Nov 2014 18:05:37 +0000
Suliman via Digitalmars-d-learn <digitalmars-d-learn at puremagic.com>
wrote:

> Sometimes it's path string may do not have tail slash of the path
> Compare:
> 
> string path = "C:\\folder\\name"
> string path = "C:\\folder\\name\\"
> 
> in case if I need to append file name to path to get full path I 
> can get error like:
> path ~= foo.txt
> "C:\\folder\\namefoo.txt"
> instead of
> "C:\\folder\\name\\foo.txt"
> 
> what is the best way to add tail slash if it's not exists?
> 
see std.path, it contains alot of useful things.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20141127/d0e90319/attachment.sig>


More information about the Digitalmars-d-learn mailing list