Get first part of a string: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
m (Updated author and download links, and changed format of some pages.) |
m (Updated author links.) |
||
Line 1: | Line 1: | ||
{|align=right | |||
|<small>Author: [[{{ns:2}}:Afrow UK|Afrow UK]] ([[{{ns:3}}:Afrow UK|talk]], [[{{ns:-1}}:Contributions/Afrow UK|contrib]])</small> | |||
|} | |||
<br style="clear:both;"> | |||
== Description == | == Description == | ||
This script allows you to get the part of the input string before the first space " " or before a character of your choice. | This script allows you to get the part of the input string before the first space " " or before a character of your choice. | ||
Line 37: | Line 41: | ||
-Stuart | -Stuart | ||
Revision as of 02:58, 30 April 2005
Author: Afrow UK (talk, contrib) |
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