Hi!
I have a path ending with ".obj". What function could remove it?
-Olivier
VEX String, remove ".obj" from path
1060 3 1- olivierth
- Member
- 1004 posts
- Joined: April 2017
- Offline
- olivierth
- Member
- 1004 posts
- Joined: April 2017
- Offline
- tamte
- Member
- 8538 posts
- Joined: July 2007
- Offline
olivierthjust join all but last together
I ended up using the split function. It works but I'm afraid I might run into problems with paths that contain more that one "." Like "...geo.0001.obj"
string path = "/some/path/file.name.ext"; string path_noext = join(split(path, ".")[:-1], ".");
that being said you may still run into issues for extensions that have . in there
like .bgeo.sc, even though you can use .bgeosc yourself but just in general
anyway there will always be edge cases you may want to account for or not
Edited by tamte - Oct. 20, 2021 17:25:53
Tomas Slancik
FX Supervisor
Method Studios, NY
FX Supervisor
Method Studios, NY
- Hamilton Meathouse
- Member
- 169 posts
- Joined: Nov. 2013
- Offline
Tamte answers this another way in an older thread: www.sidefx.com/forum/topic/57128/
string path = "../my/path/to/geo.0001.obj"; s@path = re_replace(".obj", "", path);
-
- Quick Links