Re: Remove filename from path

2014-09-25 Thread monarch_dodra via Digitalmars-d-learn
On Wednesday, 24 September 2014 at 17:15:39 UTC, Ali Çehreli wrote: find() and friends can be used: import std.algorithm; void main() { string path = myFile.doc; string extension = .doc; path = findSplitBefore(path, extension)[0]; assert(path == myFile); } I had thought of

Re: Remove filename from path

2014-09-25 Thread Jay Norwood via Digitalmars-d-learn
On Wednesday, 24 September 2014 at 10:28:05 UTC, Suliman wrote: string path = thisExePath() Seems like dirName in std.path is a good candidate ;) http://dlang.org/phobos/std_path.html#.dirName You'll find many other path manipulation functions there. Thanks! But if I want to strip it, how I

Re: Remove filename from path

2014-09-25 Thread Jay Norwood via Digitalmars-d-learn
On Friday, 26 September 2014 at 03:32:46 UTC, Jay Norwood wrote: On Wednesday, 24 September 2014 at 10:28:05 UTC, Suliman wrote: string path = thisExePath() Seems like dirName in std.path is a good candidate ;) http://dlang.org/phobos/std_path.html#.dirName You'll find many other path

Remove filename from path

2014-09-24 Thread Suliman via Digitalmars-d-learn
What is the best way to remove file name from full path? string path = thisExePath()

Re: Remove filename from path

2014-09-24 Thread monarch_dodra via Digitalmars-d-learn
On Wednesday, 24 September 2014 at 10:11:04 UTC, Suliman wrote: What is the best way to remove file name from full path? string path = thisExePath() Seems like dirName in std.path is a good candidate ;) http://dlang.org/phobos/std_path.html#.dirName You'll find many other path manipulation

Re: Remove filename from path

2014-09-24 Thread Suliman via Digitalmars-d-learn
string path = thisExePath() Seems like dirName in std.path is a good candidate ;) http://dlang.org/phobos/std_path.html#.dirName You'll find many other path manipulation functions there. Thanks! But if I want to strip it, how I can cut it?

Re: Remove filename from path

2014-09-24 Thread Suliman via Digitalmars-d-learn
I can't understand how to use strip? For example I would like to cut just extension. path = path.stripRight(exe); Error: no overload matches for stripRight(C)(C[] str) if

Re: Remove filename from path

2014-09-24 Thread ketmar via Digitalmars-d-learn
On Wed, 24 Sep 2014 10:35:28 + Suliman via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: I can't understand how to use strip? For example I would like to cut just extension. std.path.setExtension is your friend. signature.asc Description: PGP signature

Re: Remove filename from path

2014-09-24 Thread monarch_dodra via Digitalmars-d-learn
On Wednesday, 24 September 2014 at 10:35:29 UTC, Suliman wrote: I can't understand how to use strip? For example I would like to cut just extension. path = path.stripRight(exe); Error: no overload matches for stripRight(C)(C[] str) if stripExtension would be your friend here. If you want

Re: Remove filename from path

2014-09-24 Thread monarch_dodra via Digitalmars-d-learn
On Wednesday, 24 September 2014 at 10:35:29 UTC, Suliman wrote: I can't understand how to use strip? For example I would like to cut just extension. path = path.stripRight(exe); Error: no overload matches for stripRight(C)(C[] str) if strip doens't work that way. It simply removes

Re: Remove filename from path

2014-09-24 Thread ketmar via Digitalmars-d-learn
On Wed, 24 Sep 2014 12:21:40 + monarch_dodra via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: Unfortunately, there is no generic function that allows striping of a specific ending range but for strings we have std.string.chomp. signature.asc Description: PGP signature

Re: Remove filename from path

2014-09-24 Thread monarch_dodra via Digitalmars-d-learn
On Wednesday, 24 September 2014 at 12:29:09 UTC, ketmar via Digitalmars-d-learn wrote: On Wed, 24 Sep 2014 12:21:40 + monarch_dodra via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: Unfortunately, there is no generic function that allows striping of a specific ending range

Re: Remove filename from path

2014-09-24 Thread ketmar via Digitalmars-d-learn
On Wed, 24 Sep 2014 12:39:01 + monarch_dodra via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: I missread that documentation. I thought it removed all characters that can also be found in delim. Power to me. ah, i just found this function (really, less than hour ago), that's

Re: Remove filename from path

2014-09-24 Thread Ali Çehreli via Digitalmars-d-learn
On 09/24/2014 05:21 AM, monarch_dodra wrote: On Wednesday, 24 September 2014 at 10:35:29 UTC, Suliman wrote: I can't understand how to use strip? For example I would like to cut just extension. path = path.stripRight(exe); Error: no overload matches for stripRight(C)(C[] str) if strip