Jochem Posted March 12, 2009 Share Posted March 12, 2009 (edited) I want to delete all the entries that starts with xxxx or to extract all the entries that doesn`t start with xxxx. so i thought that _ArrayFindAll($aArray,"ws-c",0,0,0,1,0) would do the tric but this is giving me just the rowindex how can I solve this? Edited March 12, 2009 by Jochem Link to comment Share on other sites More sharing options...
PsaltyDS Posted March 12, 2009 Share Posted March 12, 2009 I want to delete all the entries that starts with xxxx or to extract all the entries that doesn`t start with xxxx. so i thought that _ArrayFindAll($aArray,"ws-c",0,0,0,1,0) would do the tric but this is giving me just the rowindex how can I solve this? Just loop through the array (in reverse, with Step -1) and _ArrayDelete() the unwanted elements. 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...
Jochem Posted March 13, 2009 Author Share Posted March 13, 2009 Just loop through the array (in reverse, with Step -1) and _ArrayDelete() the unwanted elements. Func _sortarrayworkstations() $todelete = _ArraySearch($aComplist, "xxxx","","",0,1,0,0) For $element = 1 To $todelete Step -1 _ArrayDelete($aCompList,$element) Next EndFunc hmmm, I tried this, but it is not working like I want? Link to comment Share on other sites More sharing options...
PsaltyDS Posted March 13, 2009 Share Posted March 13, 2009 Func _sortarrayworkstations() $todelete = _ArraySearch($aComplist, "xxxx","","",0,1,0,0) For $element = 1 To $todelete Step -1 _ArrayDelete($aCompList,$element) Next EndFunc hmmm, I tried this, but it is not working like I want? Still making it harder than necessary. Like this: #include <Array.au3> Global $aComplist[12] = ["xxxx1", "yyyy2", "zzzz3", "xxxx4", "yyyy5", "zzzz6", _ "xxxx7", "yyyy8", "zzzz9", "xxxx10", "yyyy11", "zzzz12"] _sortarrayworkstations() _ArrayDisplay($aCompList, "$aCompList") Func _sortarrayworkstations() For $n = UBound($aCompList) - 1 To 0 Step -1 If StringLeft($aCompList[$n], 4) = "xxxx" Then _ArrayDelete($aCompList, $n) Next EndFunc 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...
Jochem Posted March 13, 2009 Author Share Posted March 13, 2009 Still making it harder than necessary. Like this: #include <Array.au3> Global $aComplist[12] = ["xxxx1", "yyyy2", "zzzz3", "xxxx4", "yyyy5", "zzzz6", _ "xxxx7", "yyyy8", "zzzz9", "xxxx10", "yyyy11", "zzzz12"] _sortarrayworkstations() _ArrayDisplay($aCompList, "$aCompList") Func _sortarrayworkstations() For $n = UBound($aCompList) - 1 To 0 Step -1 If StringLeft($aCompList[$n], 4) = "xxxx" Then _ArrayDelete($aCompList, $n) Next EndFunc thanx!! 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