Files
Citadel-Station-13-RP/code/__HELPERS/lists/string.dm
2020-02-08 00:41:54 -07:00

29 lines
720 B
Plaintext

//Returns a list in plain english as a string
/proc/english_list(list/input, nothing_text = "nothing", and_text = " and ", comma_text = ", ", final_comma_text = "" )
var/total = input.len
if (!total)
return "[nothing_text]"
else if (total == 1)
return "[input[1]]"
else if (total == 2)
return "[input[1]][and_text][input[2]]"
else
var/output = ""
var/index = 1
while (index < total)
if (index == total - 1)
comma_text = final_comma_text
output += "[input[index]][comma_text]"
index++
return "[output][and_text][input[index]]"
//Removes a string from a list
/proc/remove_strings_from_list(string, list/L)
if(!LAZYLEN(L) || !string)
return
while(string in L)
L -= string
return L