String Manipulation impossible with "\" char


I’m using URL to File Path to get Parent Folder.
let’s say it is.

I would like to convert it to go to root folder:

so I tried to do it via string manipulation with
lastIndexOfChar($Parent folder$, ’ \ ‘)1 but it returns a “invalid character constant”
I tried with lastIndexOfChar($Parent folder$, ’ \ "’)1 but it doesn’t give me the good position of the character (it returns -1)…
1 (without the space, but if I write it attached, it is not displayed on this forum…

How can I transform c:\users\me\knime\files to c:\users\me\knime ?
(this is to be used in a “Create File Name” node)

Thank you.


I’m answering myself… this needs a second \ => \ \ that the knime will see as 1 \

so to get my root folder…
substr($Parent folder$,0,lastIndexOfChar($Parent folder$, ’ \ \ ')) [without space]

Thank you.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.