Skip to content
⌘ NSIS Forum Archive

String manipulation functions

5 posts

Zaraza#

String manipulation functions

I was recently doing some work and realized I was badly in need of some basic string manipulation functions (left, right, substring)...which NSIS does not have 😢

Any chance there is some plans to add them in the future? Or maybe there is some addon I could use (I don't know C++ so writing my own extension DLL is not possible).

thx
kichik#
You can do it all with the basic functions you already have in NSIS. If you can be a little more specfic on what functions you are missing I can help you find/write them.
brainsucker#
Re: String manipulation functions

Originally posted by Zaraza
I was recently doing some work and realized I was badly in need of some basic string manipulation functions (left, right, substring)
Left? Right? Substring? Huh 🙂)))
There is only one answer: StrCpy 🙂

4.12.1 StrCpy
StrCpy user_var(destination) str[maxlen] [start_offset]

Sets the user variable $x with str. Note that str can contain other variables, or the user variable being set (concatenating strings this way is possible, etc). If maxlen is specified, the string will be a maximum of maxlen characters (if maxlen is negative, the string will be truncated abs(maxlen) characters from the end). If start_offset is specified, the source is offset by it (if start_offset is negative, it will start abs(start_offset) from the end of the string).

P.S. That's not my text 🙂 Take the latest NSIS version here http://nsis.sourceforge.net/nightly/nsis.zip and read the documentation at ${NSISDIR}\Docs.
brainsucker#
Docs

<offtopic>
Forget about it... I'm creating new installer (previous one was a very simply one) with modern interface for just a 2 days, and kichik already described to me 3 or 4 documented NSIS functions I haven't noticed by myself 🙂

It is sometimes so hard to find something at this damn documentation (at least the old one, the new one is not tested for compatibility with my mind yet)... 🙂
</offtopic>
... Good day today, and NSIS is cool ... 🙂