6

Is there any function which can cut string by letter index? I mean the X letters from the end?

!define myString "abcdefg"

I need to get for ex. "efg"

i tried to do that with nsis strings functions but didnt found what can help me. ${StrStr} and all the other functions doesnt do the work

Thanks

user2269104
  • 207
  • 2
  • 7

2 Answers2

11

This is very simple. Actually, you don't have any dedicated function to do that, but you StrCpy can do that with 3rd and 4th arguments.

The format is going like that:

user_var(destination) str [maxlen] [start_offset]

And the usage for you case, is:

StrCpy $0 $myString "" -3

$0 will be: efg

More information about StrCpy function, can be found out there: http://nsis.sourceforge.net/Reference/StrCpy

Idan Gozlan
  • 3,173
  • 3
  • 30
  • 47
2
StrCpy $0 "abcdefg" "" -3 ; variable $0 now has the last 3 letters

See the manual for more info about StrCpy

Anders
  • 97,548
  • 12
  • 110
  • 164