Archive: String Manipulation


String Manipulation
Hi,

I am trying to write a bit of code to cut the last character and first 4 characters off of an input. $2 is the string passed into it and can be a varied length.

StrLen $R3 $2
IntOp $R3 $R3 - 1
StrCpy $2 $2 $R3 4

However the above code does not work. If you replace $R3 with a static value it does work but this doesn't help me as $R3 has a varied length. I was wondering if this is a problem with everything being considered as a string in NSIS.

Can anyone give me an example of how this should be done?


StrCpy $2 $2 -1 4

Thanks, didn't realise you could do that