sc4ry Posted August 18, 2007 Share Posted August 18, 2007 hello, i´m searching for an script, which deletes entries in an array. i have 2 arrays, which i join with array2djoin. after this i want to delete all entries, which are 2 times or more in the new array. after this, the new array should only contain entries, which was in the first OR the second array. arrayunique does not work, because it does only delete one of double-entrie. do you know such a script? Link to comment Share on other sites More sharing options...
PsaltyDS Posted August 18, 2007 Share Posted August 18, 2007 hello,i´m searching for an script, which deletes entries in an array.i have 2 arrays, which i join with array2djoin. after this i want to delete all entries, which are 2 times or more in the new array.after this, the new array should only contain entries, which was in the first OR the second array.arrayunique does not work, because it does only delete one of double-entrie.do you know such a script?I am not familiar with 'arrayunique' but if it works you could just run it in a loop until no duplicates were found. 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...
sc4ry Posted August 18, 2007 Author Share Posted August 18, 2007 (edited) when there are 2 entries which are the same, it deletes one of them, so after using it, there are no more doubles in it. after that it will do nothing, cause it can´t find any doubles ... that does not work =) this is the arrayunique-function. i think that this could be modified, that it deletes both entries and then only returns entrys without doubles ... but i don´t understand the technique of arrayunique =) Func _ArrayUnique(ByRef $aArray, $vDelim = '', $iBase = 1, $iUnique = 1) If $vDelim = '' Then $vDelim = Chr(01) Local $sHold For $iCC = $iBase To UBound($aArray) - 1 If Not StringInStr($vDelim & $sHold, $vDelim & $aArray[$iCC] & $vDelim, $iUnique) Then _ $sHold &= $aArray[$iCC] & $vDelim Next Return StringSplit(StringTrimRight($sHold, StringLen($vDelim)), $vDelim) EndFunc ;==>_ArrayUnique Edited August 18, 2007 by sc4ry Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted August 18, 2007 Moderators Share Posted August 18, 2007 (edited) when there are 2 entries which are the same, it deletes one of them, so after using it, there are no more doubles in it. after that it will do nothing, cause it can´t find any doubles ... that does not work =) this is the arrayunique-function. i think that this could be modified, that it deletes both entries and then only returns entrys without doubles ... but i don´t understand the technique of arrayunique =) Func _ArrayUnique(ByRef $aArray, $vDelim = '', $iBase = 1, $iUnique = 1) If $vDelim = '' Then $vDelim = Chr(01) Local $sHold For $iCC = $iBase To UBound($aArray) - 1 If Not StringInStr($vDelim & $sHold, $vDelim & $aArray[$iCC] & $vDelim, $iUnique) Then _ $sHold &= $aArray[$iCC] & $vDelim Next Return StringSplit(StringTrimRight($sHold, StringLen($vDelim)), $vDelim) EndFunc ;==>_ArrayUnique Edited August 18, 2007 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted August 18, 2007 Moderators Share Posted August 18, 2007 I can't edit the last post??? Anyway, I think I understand now... try this and see if it works:Func _ArrayTotalUnique(ByRef $aArray, $vDelim = '', $iBase = 1, $iUnique = 1) If $vDelim = '' Then $vDelim = Chr(01) Local $sHold, $sHoldArray For $iCC = $iBase To UBound($aArray) - 1 $sHoldArray &= $aArray[$iCC] & $vDelim Next For $iCC = $iBase To UBound($aArray) - 1 If Not StringInStr($vDelim & $sHoldArray, $vDelim & $aArray[$iCC] & $vDelim, $iUnique, 2) Then _ $sHold &= $aArray[$iCC] & $vDelim Next Return StringSplit(StringTrimRight($sHold, StringLen($vDelim)), $vDelim) EndFunc Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
sc4ry Posted August 18, 2007 Author Share Posted August 18, 2007 yeah thanks, this works fine =) 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