More List Functions
Additional functions for working with lists:
-
ListValid determines whether a string is a list.
-
ListFromString returns a list built from a delimited string.
-
ListToString returns a delimited string built from a list.
-
ListSame compares 2 lists item by item, and returns 1 if they are identical, 0 otherwise.
-
ListNext advances sequentially from one list item to the next.
Note:
The ListNext function changes the value of its second and third arguments.
addr = "One Memorial Drive" : city = "Cambridge" : st = "MA" : zip = "02142"
Pmail = addr & "^" & city & "^" & st & "^" & zip
Lmail = listfromstring(Pmail, "^")
println "Lmail is a valid list: ", listvalid(Lmail)
println "Pmail is not a valid list: ", listvalid(Pmail)
println "City is in position #2: ", list(Lmail, 2)
println "There are 4 items in the list: ", listlength(Lmail)
println "MA is in position: ", listfind(Lmail, "MA")
Pmail = listtostring(Lmail,"*")
println Pmail
Lmail2 = listbuild("One Memorial Drive","Cambridge","MA","02141")
println "Lmail and Lmail2 are not the same list: ", listsame(Lmail, Lmail2)
p = 0 : while listnext(Lmail, p, value) : println value : wend