StrLower: 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}}:anonymous|anonymous]] ([[{{ns:3}}:anonymous|talk]], [[{{ns:-1}}:Contributions/anonymous|contrib]])</small> | |||
|} | |||
<br style="clear:both;"> | |||
== Description == | == Description == | ||
This function converts a string into lower case. This doesn't work with latin accents and Unicode. | This function converts a string into lower case. This doesn't work with latin accents and Unicode. | ||
Line 44: | Line 48: | ||
== Credits == | == Credits == | ||
[[StrUpper]]'s idea was provided by Dave Laundon aka [[user:eccles | eccles]]. | [[StrUpper]]'s idea was provided by Dave Laundon aka [[user:eccles | eccles]]. | ||
Revision as of 03:04, 30 April 2005
Author: anonymous (talk, contrib) |
Description
This function converts a string into lower case. This doesn't work with latin accents and Unicode.
The Function
; StrLower ; Converts the string on the stack to lowercase (in an ASCII sense) ; Usage: ; Push ; Call StrLower ; Pop Function StrLower Exch $0 ; Original string Push $1 ; Final string Push $2 ; Current character Push $3 Push $4 StrCpy $1 "" Loop: StrCpy $2 $0 1 ; Get next character StrCmp $2 "" Done StrCpy $0 $0 "" 1 StrCpy $3 122 ; 122 = ASCII code for z Loop2: IntFmt $4 %c $3 ; Get character from current ASCII code StrCmp $2 $4 Match IntOp $3 $3 - 1 StrCmp $3 91 NoMatch Loop2 ; 90 = ASCII code one beyond Z Match: StrCpy $2 $4 ; It 'matches' (either case) so grab the lowercase version NoMatch: StrCpy $1 $1$2 ; Append to the final string Goto Loop Done: StrCpy $0 $1 ; Return the final string Pop $4 Pop $3 Pop $2 Pop $1 Exch $0 FunctionEnd