ID:139230
 
mob
proc
TXTtoHTML()
var/http[]=world.Export("http://www.angelfire.com/getenks/Subscribers.txt")
var/F=http["CONTENT"]
var/key
var/date
if(F)
var/FX=html_encode(file2text(F))
key=copytext(FX,1,findtext(FX,"/"))
date=copytext(FX,findtext(FX,"/")+1)
SUBLIST[key]=date
for(var/M in SUBLIST)
usr<<"[M]=[SUBLIST[M]]"

verb
Test()
usr.TXTtoHTML()
this is the code i used and this is the list i am getting
BOF=01-01-00
Get Games/01-01-99
Getenks/01-01-99
Quixotic/04-12-99
Falacy/01-01-99
ShadowXLX2/01-01-99
Ajith/01-01-99
SSJ Sreehari/08-10-99
Vysakh_vegeta/01-01-99
SSJ Jais/01-01-99
95faridbang95/10-11-99
Redteks/12-11-99
Tugastef/01-01-99
Hassanjalil/01-01-99
KakarottSSJ3/18-03-99
Silent Assain/01-05-99
EOF/01-01-99


i wanted to create a list from http://hassanjalil.angelfire.com/subscription.txt and then put it in Html like this
Honestly it would be far easier to instead store the list in params form, so for example:
El Wookie=99-99-99;Tom=01-01-01


This will make it a far easier to manipulate thanks to list2params and params2list, like so:

var/http[]=world.Export("http://www.angelfire.com/getenks/Subscribers.txt")
var/F=http["CONTENT"]
F = params2list(F)
for(var/listing in F)
world<<"[F]: [F[F]]"


From that you just need to add in the appropriate html.
In response to El Wookie
but isnt there any way to get this type of list into html because i have coded my code according to this list if i change it i have to change all of my code
You aren't iterating through the file in any manner, so it's only actually parsing one "line" of the file. Line is in quotes because you aren't actually dividing up the file line-by-line, so you just have (first token) = (rest of the file).

So, what you need first is a function that breaks it up into separate lines:

// Break up a text string into tokens
proc/tokenize(var/string, var/delimiter)
var/length = length(delimiter)
var/list/L = list()
var/lastpos = 1
var/pos = findtext(string, delimiter)
while(pos != 0)
L += copytext(string, lastpos, pos)
lastpos = pos + length
pos = findtext(string, delimiter, lastpos)
L += copytext(string, lastpos)
return L


Then, you can use that, and iterate through the individual lines to grab the key and the date:

var/list/L = tokenize(FX)
for(var/token in L)
// Split the data into its two tokens
var/list/data = tokenize(token, "/")
if(data.length == 2)
var/key = data[1]
var/date = data[2]
else
// Malformed data, ignore it