Best way to add slash to tail of the path

Suliman via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Nov 27 10:05:37 PST 2014


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?



More information about the Digitalmars-d-learn mailing list