package require http
set cmd "!updates"
bind pub -|- $cmd test
proc test {nick uhost hand chan text} {
putquick "NOTICE $nick :let's hope this is faster"
set tok [::http::geturl "http://www3.telus.net/dekan/newrlsd.txt"]
set data [::http::data $tok]
foreach z [split $data \n] {
putquick "NOTICE $nick :$z"
}
::http::cleanup $tok
}
11/11/02|Knights of Ramune (DVD)|01|Perfect-Anime|
11/12/02|Asagiri no Miko|07-08|Elite-Fansubs|
11/13/02|Southern Cross (DVD)|13-15|ILA|
11/18/02|Urusei Yatsura (DVD)|1-4|ILA|
i want the bot to parse this output to only display the line if it matches a certain date. like today is 11/18/02, how do i make the bot display only the 11/18/02 line?
split is a list command. It operated on strings, and converts them into lists. These brackets are used to designate the begining and end of a item within a list.
As you have done, you have split the string, using |.
You can then use the "join" command to convert from a list, into a string. Again, you need to specify a charater, you use as a joining character. If you where to use a |, it would return your original list (to show how it works). You can use " " (including quotes) to join it with a space.
Notice the {} at the end of the list. This is because you have a | at the end of the string. To get around this, you can use "string trim" to remove the end white space that "join" will generate.