String manipulation - join

Heya

This is bit annoying but I cant figure it out.

So basically :

str = rendOutputFilename
Divide = filterString str "\\"

This gets me the location where I save images and split the string in to groups.

Now I want to remove the last group which is the name of file so all I will be left with is patch.

how can I now substract that last part and re-join it all so its proper "C:/test/test/test/"

Regards

Dariusz

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
barigazy's picture

...

You are asking for this

str = "C:\\SomeFolder\\SomeSubfolder\\image.jpg"
strParts = filterstring str "\\"
newpath = ""
for s = 1 to strParts.count-1 do append newpath (strParts[s]+"/")
newpath

This is wrong way.
This will be one of meny ways but is better from previous for sure

str = "C:\\SomeFolder\\SomeSubfolder\\image.jpg"
filepath = pathConfig.removePathLeaf str
newfilename = pathConfig.appendpath filepath "newimage.png"

barigazy

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.