Sort String 3: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
m (Wikipedia python library) |
m (Updated author and download links, and changed format of some pages.) |
||
Line 69: | Line 69: | ||
-Stu (Afrow UK) | -Stu (Afrow UK) | ||
Page author: Afrow UK | Page author: [[User:Afrow UK|Afrow UK]] |
Revision as of 12:35, 23 April 2005
Description
This script will get all text left and right of a single specified character, removing everything else.
Usage
Push "( 3320 -2032 -344 ) ( 3320 -2032 -368 ) dday/mr_woodfloor1 0 23" ;input Push "/" ;centre character Push " " ;right character Push " " ;left character Call StrSortLR Pop $0 ;output string
$0 = dday/mr_woodfloor1
The Function
Function StrSortLR Exch $0 ;left character Exch Exch $1 ;right character Exch Exch 2 Exch $2 ;centre character Exch 2 Exch 3 Exch $3 ;input string Exch 3 Push $4 Push $5 StrCpy $5 0 loop1: IntOp $5 $5 - 1 StrCpy $4 $3 1 $5 StrCmp $4 "" error StrCmp $4 $2 0 loop1 IntOp $5 $5 + 1 loop2: StrCpy $4 $3 1 $5 IntOp $5 $5 + 1 StrCmp $4 "" loop3 StrCmp $4 $1 0 loop2 IntOp $5 $5 - 1 StrCpy $3 $3 $5 StrCpy $5 0 loop3: IntOp $5 $5 - 1 StrCpy $4 $3 1 $5 StrCmp $4 "" error StrCmp $4 $0 0 loop3 IntOp $5 $5 + 1 StrCpy $3 $3 "" $5 Goto exit error: StrCpy $3 error exit: StrCpy $0 $3 Pop $5 Pop $4 Pop $3 Pop $2 Pop $1 Exch $0 ;output string FunctionEnd
Written by me for sorting through a Quake2 .Map file to get hold of the texture names.
-Stu (Afrow UK)
Page author: Afrow UK