Archive: Function to trim a string


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


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:
http://nsis.sourceforge.net/Docs/AppendixC.html#C.1

-Stu


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
http://nsis.sourceforge.net/archive/...php?pageid=562

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.)