|
|
#1 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
Need to get the last bit of a string
I have a path entered by the user which may be:
C:\quake2\baseq2\maps\gbrdday1.map How can I get the gbrdday1.map bit. Note that it could be anything, not at all gbrdday1.map Basicly, the bit after the last \ is what I want. -Stuart |
|
|
|
|
|
#2 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,343
|
You can tweak GetParent to do the trick. And if you don't want to handle the code too much you can get the length of the returned string and trim up to that point using StrCpy with a negative maxlen.
NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
|
|
|
|
|
#3 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
Here is the script:
I'm not sure how to return it to Exch, Pop and Pushing the variables around, so I've left it as this. KiCHiK, please show me what the basec Pop, Push and Exch cmds should be. Usage: StrCpy $R0 C:\Geoffrey\Freddy Call GetFileName DetailPrint $R3 # $R3 is now Freddy code: Thanks -Stuart |
|
|
|
|
|
#4 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,343
|
Haven't tested it but it should work:
PHP Code:
NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|