FuryCell Posted June 17, 2005 Posted June 17, 2005 (edited) This is based off of ExpandEnvStrings () which was made by Blindwig. I just modified it with permission from Blindwig.It expands variables in a string. to use it just put the variable name in between two $ signs if you want to have a literal $ then double it up like $$.#CS Test (Note this test must be run in scite.) $A="This is a test" ConsoleWrite(_ExpandVarStrings("A=$A$ $$")) #CE Func _ExpandVarStrings($sInput) Dim $aPart = StringSplit($sInput,'$') If @error Then SetError(1) Return $sInput EndIf Dim $sOut = $aPart[1], $i = 2, $Var = '' ;loop through the parts While $i <= $aPart[0] $Var = Eval ($aPart[$i]) If $Var <> '' Then;this part is an expandable Variable $sOut = $sOut & $Var $i = $i + 1 If $i <= $aPart[0] Then $sOut = $sOut & $aPart[$i] ElseIf $aPart[$i] = '' Then;a double-$ is used to force a single $ $sOut = $sOut & '$' $i = $i + 1 If $i <= $aPart[0] Then $sOut = $sOut & $aPart[$i] Else;this part is to be returned literally $sOut = $sOut & '$' & $aPart[$i] EndIf $i = $i + 1 WEnd Return $sOut EndFuncNote:ExpandEnvStrings() can be found here. Edited June 18, 2005 by SolidSnake HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now