| View previous topic :: View next topic |
| Author |
Message |
Guest
|
Posted: Thu Jan 07, 2010 4:41 am Post subject: subract list 1 from list 2 |
|
|
i have two lists
one list is of admins and other of mods
admins
dylan
carasi
shawn
paul
valicous
mods
dylan
chris
carasi
priya
cupcakes
shawn
paul
valicous
i want to remove the admins from mods list ... ( subract items of admins list from mods list )
the resulted list should be
chris
priya
cupcakes |
|
| Back to top |
|
 |
Klaus
Joined: 12 May 2005 Posts: 325 Location: Münster, Germany
|
Posted: Thu Jan 07, 2010 6:14 am Post subject: |
|
|
Hi, Guest (a nick would be nice),
I assume you've got your lists in memory.
Now you parse the first one (have a look at the loop-command) with the admins to access the admins one by one. For each found admin you try to remove him from the second list (have a look at the StringReplace-command). That's it! Watch out for admin-names which are substrings of mod-names and handle them with care!
Regards,
Klaus
PS: In case of non success, post your code and there will be help! |
|
| Back to top |
|
 |
SoLong&Thx4AllTheFish
Joined: 27 May 2007 Posts: 4999
|
Posted: Thu Jan 07, 2010 6:16 am Post subject: |
|
|
If you have admins.txt and mods.txt you could use http://www.autohotkey.net/~hugov/tf-lib.htm#TF_Substract | Code: | | TF_Substract("admins.txt", "mods.txt") |
Edit: This also works with vars like so | Code: | admins=
(join`r`n ; this is important to add if you work with vars
dylan
carasi
shawn
paul
valicous
)
mods=
(join`r`n
dylan
chris
carasi
priya
cupcakes
shawn
paul
valicous
)
; i want to remove the admins from mods list ...
; ( subract items of admins list from mods list )
MsgBox % TF_Substract(admins, mods) |
_________________ AHK Wiki FAQ
TF : Text files & strings lib, TF Forum |
|
| Back to top |
|
 |
|