Skip to content
⌘ NSIS Forum Archive

Function to trim a string

3 posts

Guest#

Function to trim a string

Hello i have a question I need to get a value from a string witout the dot. How can I do?
sample c:\pedro\pedrito.exe I need only c:\pedro

Thanks to all
Afrow UK#
Use GetParent function. I think it's in the NSIS docs.
If it's no in there, you can get it from the Archive

Edit:


-Stu
Comperio#
Your original message states
I need to get a value from a string witout the dot.
So, I wonder: Do you really mean that "c:\pedro\pedrito.exe" should be "c:\pedro\pedrito"?

If so, then you might look at a simple function I created to get the base name of a string


It basically takes a string and removes the extension part of the file name (working from left to right). It works exactly like the VBScript command 'GetBaseName' does.

(But if I misunderstood and you really just needed to get the parent folder, then Afrow's suggestion is what you'll want to use.)