JRSmile Posted June 9, 2007 Share Posted June 9, 2007 I have missed the stringbuilder functionality from VB.NET inautoit so i added a little UDF to easily add strings together. every call of _adstr() adds the given variable to the string. If _adstr() is called without arguments the string will be returned and deleted. #region examples _adstr("1") _adstr("1") _adstr("1") ConsoleWrite(_adstr()) _adstr("2") _adstr("3") _adstr("4") ConsoleWrite(_adstr()) _adstr("5") _adstr(@CRLF & @ComputerName & @CRLF) _adstr("6") ConsoleWrite(_adstr()) #endregion Func _adstr($text = "") if $text = "" Then $tmp = Eval("adstr_var") Assign("adstr_var","") Return $tmp EndIf Assign("adstr_var",Eval("adstr_var") & $text,2) Return Eval("adstr_var") EndFunc $a=StringSplit("547275737420796F757220546563686E6F6C75737421","") For $b=1 To UBound($a)+(-1*-1*-1)step(2^4/8);&$b+=1*2/40*µ&Asc(4) Assign("c",Eval("c")&Chr(Dec($a[$b]&$a[$b+1])));''Chr("a")&"HI" Next ;time_U&r34d,ths,U-may=get$the&c.l.u.e;b3st-regards,JRSmile; MsgBox(0x000000,"",Eval("c"));PiEs:d0nt+*b3.s4d.4ft3r.1st-try:-) Link to comment Share on other sites More sharing options...
poisonkiller Posted June 9, 2007 Share Posted June 9, 2007 Nice script! But wouldn't it be less code this way: #region examples $str = "1" $str &= "1" $str &= "1" ConsoleWrite($str) $str = "2" $str &= "3" $str &= "4" ConsoleWrite($str) $str = "5" $str &= @CRLF & @ComputerName & @CRLF $str &= "6" ConsoleWrite($str) #endregion Link to comment Share on other sites More sharing options...
ConsultingJoe Posted June 9, 2007 Share Posted June 9, 2007 Nice script! But wouldn't it be less code this way: #region examples $str = "1" $str &= "1" $str &= "1" ConsoleWrite($str) $str = "2" $str &= "3" $str &= "4" ConsoleWrite($str) $str = "5" $str &= @CRLF & @ComputerName & @CRLF $str &= "6" ConsoleWrite($str) #endregionyes it would Check out ConsultingJoe.com Link to comment Share on other sites More sharing options...
JRSmile Posted June 10, 2007 Author Share Posted June 10, 2007 yes it wouldyes but you can alter the function to add for example @CRLFs to it and you have an easy formatting solution for mass output of strings.i just wanted to demonstrate that you don't need to have to register a variable for every kind of stuff mLipok 1 $a=StringSplit("547275737420796F757220546563686E6F6C75737421","") For $b=1 To UBound($a)+(-1*-1*-1)step(2^4/8);&$b+=1*2/40*µ&Asc(4) Assign("c",Eval("c")&Chr(Dec($a[$b]&$a[$b+1])));''Chr("a")&"HI" Next ;time_U&r34d,ths,U-may=get$the&c.l.u.e;b3st-regards,JRSmile; MsgBox(0x000000,"",Eval("c"));PiEs:d0nt+*b3.s4d.4ft3r.1st-try:-) Link to comment Share on other sites More sharing options...
marcusawerly Posted October 16, 2018 Share Posted October 16, 2018 On 6/9/2007 at 8:43 AM, poisonkiller said: Nice script! But wouldn't it be less code this way: #region examples $str = "1" $str &= "1" $str &= "1" ConsoleWrite($str) $str = "2" $str &= "3" $str &= "4" ConsoleWrite($str) $str = "5" $str &= @CRLF & @ComputerName & @CRLF $str &= "6" ConsoleWrite($str) #endregion Thanks for this. I know it is super duper old, but it was helpful even today. Link to comment Share on other sites More sharing options...
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