Get first part of a string: 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 38: | Line 38: | ||
-Stuart | -Stuart | ||
Page author: Afrow UK | Page author: [[User:Afrow UK|Afrow UK]] |
Revision as of 12:26, 23 April 2005
Description
This script allows you to get the part of the input string before the first space " " or before a character of your choice.
Usage
Push "HelloAll I am Afrow UK, and I love NSIS" ; Input string Call GetFirstStrPart Pop "$R0"
Where $R0 will now be "HelloAll"
The Function
Function GetFirstStrPart Exch $R0 Push $R1 Push $R2 StrLen $R1 $R0 IntOp $R1 $R1 + 1 loop: IntOp $R1 $R1 - 1 StrCpy $R2 $R0 1 -$R1 StrCmp $R2 "" exit2 StrCmp $R2 " " exit1 ; Change " " to "\" if ur inputting dir path str Goto loop exit1: StrCpy $R0 $R0 -$R1 exit2: Pop $R2 Pop $R1 Exch $R0 FunctionEnd
Written by me (Afrow UK)
-Stuart
Page author: Afrow UK