Why any substring is not find inside string?
Hello, Sorry for my beginners question. I am experimenting with CSV parsing and I have miscellaneous delimiters. Finding any delimiters is OK, but with any delimiters are problem - there are not to find inside string. Here is my minimal example: \starttext \startluacode text2split='"1";"GYZA";"382/2010";"482/2010";"402";"Májkova";"Barbora";"20.4.1995";"Zábřeh, Skalička 48";"789 53"' delim_from, delim_to = string.find(text2split, '";"') tex.sprint(tostring(delim_from),' - ', tostring(delim_to),'\\par') -- OK text2splitA='!1/;!GYZAs 482/2010/;!GYZA 382/2010/;!GYZA 482/2010/;!402/;!Májková/;!Barbora/;!ž/;!20.4.1995/;!Zábřeh/;!ČR/;!Mírov 69/;!Mírov/;!789 53/;!Májková/;!Michaela/;!Mírov 69/;!Mírov/;!789 53/;!/' delim_from, delim_to = string.find(text2splitA, '!;/') tex.sprint(tostring(delim_from),' - ', tostring(delim_to)) -- Not finding \stopluacode \stoptext Where is problem, where I making a mistake (I am beginning with Lua). Thanx Jaroslav Hajtmar
Sorry ... I see it now.. When I created mimimal example I make mistake. J.Hajtmar Dne 11.4.2010 19:30, Jaroslav Hajtmar napsal(a):
Hello, Sorry for my beginners question. I am experimenting with CSV parsing and I have miscellaneous delimiters. Finding any delimiters is OK, but with any delimiters are problem - there are not to find inside string. Here is my minimal example:
\starttext \startluacode text2split='"1";"GYZA";"382/2010";"482/2010";"402";"Májkova";"Barbora";"20.4.1995";"Zábřeh, Skalička 48";"789 53"' delim_from, delim_to = string.find(text2split, '";"') tex.sprint(tostring(delim_from),' - ', tostring(delim_to),'\\par') -- OK
text2splitA='!1/;!GYZAs 482/2010/;!GYZA 382/2010/;!GYZA 482/2010/;!402/;!Májková/;!Barbora/;!ž/;!20.4.1995/;!Zábřeh/;!ČR/;!Mírov 69/;!Mírov/;!789 53/;!Májková/;!Michaela/;!Mírov 69/;!Mírov/;!789 53/;!/' delim_from, delim_to = string.find(text2splitA, '!;/') tex.sprint(tostring(delim_from),' - ', tostring(delim_to)) -- Not finding \stopluacode
\stoptext
Where is problem, where I making a mistake (I am beginning with Lua).
Thanx Jaroslav Hajtmar
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________
participants (1)
-
Jaroslav Hajtmar