Sort String 1 (from end): Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
m (Updated author and download links, and changed format of some pages.) |
m (Adding new author and category links.) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{PageAuthor|Afrow UK}} | |||
== Description == | == Description == | ||
This script will output all after x spaces, where x is the space count from the end of the input string. | This script will output all after x spaces, where x is the space count from the end of the input string. | ||
Line 47: | Line 49: | ||
-Stu | -Stu | ||
[[Category:String Functions]] |
Latest revision as of 13:52, 24 June 2005
Author: Afrow UK (talk, contrib) |
Description
This script will output all after x spaces, where x is the space count from the end of the input string.
Usage
Push "I am Afrow UK" Push 2 Call SimpStrSort Pop $R0
$R0 will now be "Afrow UK", since "Afrow UK" is after the 2nd space from the end of the string.
The Function
Function SimpStrSort Exch $4 ; count to get part Exch Exch $0 ; input string Push $1 Push $2 Push $3 StrCpy $1 0 StrCpy $3 1 loop: IntOp $1 $1 - 1 StrCpy $2 $0 1 $1 StrCmp $2 "" exit2 StrCmp $2 " " next ; replace " " with whatever you like Goto loop next: StrCmp $3 $4 exit IntOp $3 $3 + 1 Goto loop exit2: IntOp $1 $1 - 1 exit: IntOp $1 $1 + 1 StrCpy $0 $0 "" $1 Pop $3 Pop $2 Pop $1 Exch $0 ; output string FunctionEnd
-Stu