[NSIS] StrLower

# 호출 예

# ${StrLower} '반환' '원본 문자열'
# ${StrLower} $0 $1
# ${StrLower} $0 $0
# ${StrLower} $0 "StRiNg"

!macro _StrLower un
	Function ${un}_StrLower
		Exch $R0	# Original
	string
		Push $R1	# Final
	string
		Push $R2	# Current
	character
		Push $R3
		Push $R4

		StrCpy $R1 ""
		Loop:
			StrCpy $R2 $R0 1	# Get next character
			StrCmp $R2 "" Done
			StrCpy $R0 $R0 "" 1
			StrCpy $R3 122		# 122 = ASCII code for z
		Loop2:
			IntFmt $R4 %c $R3	# Get character from current ASCII code
			StrCmp $R2 $R4 Match
			IntOp $R3 $R3 - 1
			StrCmp $R3 91 NoMatch Loop2	# 90 = ASCII code one beyond Z
		Match:
			StrCpy $R2 $R4		# It 'matches' (either case) so grab the lowercase version
		NoMatch:
			StrCpy $R1 $R1$R2	# Append to the final string
			Goto Loop
		Done:

		StrCpy $R0 $R1	# Return the
	final string

		Pop $R4
		Pop $R3
		Pop $R2
		Pop $R1
		Exch $R0
	FunctionEnd
!macroend
!insertmacro _StrLower ""
;!insertmacro _StrLower "un."

!macro StrLower OUTPUT str_origin
	Push "${str_origin}"

	!ifndef __UNINSTALL__
		Call _StrLower
	!else
		Call un._StrLower
	!endif

	Pop "${OUTPUT}"
!macroend

!define StrLower "!insertmacro StrLower"

댓글

이 블로그의 인기 게시물

[NSIS] 32비트와 64비트 모듈 등록하는 법. (regsvr32)

[Visual Studio] Windows 7 에서 Visual Studio 6.0 디버그 시 프로세스 좀비되는 증상 해결 방법