AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

subract list 1 from list 2

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Guest






PostPosted: Thu Jan 07, 2010 4:41 am    Post subject: subract list 1 from list 2 Reply with quote

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

PostPosted: Thu Jan 07, 2010 6:14 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
SoLong&Thx4AllTheFish



Joined: 27 May 2007
Posts: 4999

PostPosted: Thu Jan 07, 2010 6:16 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group