clearguy Posted August 22, 2006 Share Posted August 22, 2006 Hi, with this command,how to put more than one positions to insert string ? thanx I've never met anyone who codes binary. StringMultiInsert()SOW EncryptFrench autoit forum - forum français Link to comment Share on other sites More sharing options...
PsaltyDS Posted August 22, 2006 Share Posted August 22, 2006 (edited) Hi, with this command,how to put more than one positions to insert string ? thanx _StringInsert() only inserts in one position, but you could put it in a loop to do multiple positions: $MyString = "12345678901234567890" $Result = _StringMultiIns($MyString, " - ", "5,10,15") MsgBox(64, "Result", $Result) ; Should be "12345 - 67890 - 12345 - 67890" ; Function _StringMultiIns($sString, $sInsert, $sPos) ; Where: ; $sString = String to be changed ; $sInsert = String to insert ; $sPos = String containing comma delimited positions to insert at (i.e. 3,23,34) ; Note: All positions are in the unmodified original string, additional positions will be ; offset so inserts still occur in the same relative position. ; Returns modified string Func _StringMultiIns($sString, $sInsert, $sPos) Local $OffsetPos = 0 Local $aSplit = StringSplit($sPos, ",") For $s = 1 To $aString[0] $OffsetPos += $aString[$s] $sString = _StringInsert($sString, $sInsert, $OffsetPos) Next Return $sString EndFunc Cheers! Edited August 22, 2006 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
clearguy Posted August 22, 2006 Author Share Posted August 22, 2006 LOL I especially searched an other way that a loop,beacause it takes damn much time in my script,and much CPU usage too(a 1000x loop...):/ I've never met anyone who codes binary. StringMultiInsert()SOW EncryptFrench autoit forum - forum français Link to comment Share on other sites More sharing options...
PsaltyDS Posted August 22, 2006 Share Posted August 22, 2006 LOL I especially searched an other way that a loop,beacause it takes damn much time in my script,and much CPU usage too(a 1000x loop...):/I look forward to seeing how you do this without any loop... should be very instructive! Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
clearguy Posted August 25, 2006 Author Share Posted August 25, 2006 (edited) I look forward to seeing how you do this without any loop... should be very instructive! Here => MultiInsertString()I made a function doing this:)An evolution of simple stringinsert ps:thanx to PsaltyDS giving me an example Edited August 25, 2006 by clearguy I've never met anyone who codes binary. StringMultiInsert()SOW EncryptFrench autoit forum - forum français Link to comment Share on other sites More sharing options...
PsaltyDS Posted August 26, 2006 Share Posted August 26, 2006 Here => MultiInsertString()I made a function doing this:)An evolution of simple stringinsert ps:thanx to PsaltyDS giving me an example Bzzzt! I coun't no less than three loops! Thanks for playing! Carol has some nice parting gifts for you at the door, including the new board game version of our show! Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law 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