Im thinking this is correct, but probably WAY off.
I have a string formatted as such name, name1, name2, name3, name4, etc
admins_count = 0
if ["name2", "name3"].include?(player_list)
admins_count += 1
end
Is this the proper way to count matches in a list?
Essentially, its a list of players, I want to count how many of the names in the second list mtch against player_list.
this is what worked for me a combo of things
player_list = response[3].split(" ", 2)[1].chomp[1..-2]
admin_list = "Howard_Roark, Gerrit8500, fffizzz"
mod_list = "ZionRx, rodtang, fuzzamuzza, DJRedFlames, bingbong2715, ErebusAnima, Twentytenor2, zephyrnug, Tiberione, deadkill02, tTheoRyy, PyneApll, tercept, Hestehaven, Orjis87, Yaltar101"
mod_arr = mod_list.split(", ")
admin_arr = admin_list.split(", ")
player_arr = player_list.split(", ")
mods_count = 0
mod_arr.each do |s|
mods_count += 1 if player_arr.include? s
end
admins_count = 0
admin_arr.each do |s1|
admins_count += 1 if player_arr.include? s1
end
puts "players.value #{player_count}"
puts "mods.value #{mods_count}"
puts "admins.value #{admins_count}"