1. parsing a txt file
- Posted by spent memory <spent.memory at gmail.com> Nov 25, 2004
- 707 views
i am reading into my program a text file. in this text file i seek to a certain line and assign 1 of my variables the value which happens to be 20. however when i goto use this variable later i get a type check failure saying the variable is {50,48,10}. I know this converts to 20 but i have forgotten how to convert it so that i can use it. can someone please remind me. thanks
2. Re: parsing a txt file
- Posted by Jason Gade <jaygade at yahoo.com> Nov 25, 2004
- 711 views
spent memory wrote: > > i am reading into my program a text file. in this text file i seek to > a certain line and assign 1 of my variables the value which happens to > be 20. however when i goto use this variable later i get a type check > failure saying the variable is {50,48,10}. I know this converts to 20 > but i have forgotten how to convert it so that i can use it. can > someone please remind me. thanks > > use var = value(in) in is your input, var will be a two-element sequence with the first element being an error value and the second element being the number you are actually interested in. Refer to the library reference for value. j.
3. Re: parsing a txt file
- Posted by spent memory <spent.memory at gmail.com> Nov 25, 2004
- 725 views
thanx man On Wed, 24 Nov 2004 20:14:22 -0800, Jason Gade <guest at rapideuphoria.com> wrote: > > posted by: Jason Gade <jaygade at yahoo.com> > > > spent memory wrote: > > > > i am reading into my program a text file. in this text file i seek to > > a certain line and assign 1 of my variables the value which happens to > > be 20. however when i goto use this variable later i get a type check > > failure saying the variable is {50,48,10}. I know this converts to 20 > > but i have forgotten how to convert it so that i can use it. can > > someone please remind me. thanks > > > > > use > > var = value(in) > > in is your input, var will be a two-element sequence with the first element > being an error value and the second element being the number you are actually > interested in. > > Refer to the library reference for value. > > j. > > > >
4. Re: parsing a txt file
- Posted by Patrick Barnes <mrtrick at gmail.com> Nov 25, 2004
- 713 views
{50, 48, 10} is equal to "20\n" You need to do this: sequence junk junk = value( "20\n" ) myVar = junk[2] On Thu, 25 Nov 2004 14:06:32 +1000, spent memory <spent.memory at gmail.com> wrote: > > i am reading into my program a text file. in this text file i seek to > a certain line and assign 1 of my variables the value which happens to > be 20. however when i goto use this variable later i get a type check > failure saying the variable is {50,48,10}. I know this converts to 20 > but i have forgotten how to convert it so that i can use it. can > someone please remind me. thanks > > -- MrTrick
5. Re: parsing a txt file
- Posted by spent memory <spent.memory at gmail.com> Nov 25, 2004
- 722 views
what do u mean, to strip the line feed ascii?? , i used the method earlier posted by jason and it seems to work fine thanks anyway :) On Thu, 25 Nov 2004 15:15:43 +1100, Patrick Barnes <mrtrick at gmail.com> wrote: > > {50, 48, 10} is equal to "20\n" > > You need to do this: > sequence junk > junk = value( "20\n" ) > > myVar = junk[2] > > > On Thu, 25 Nov 2004 14:06:32 +1000, spent memory <spent.memory at gmail.com> > wrote: > > > > i am reading into my program a text file. in this text file i seek to > > a certain line and assign 1 of my variables the value which happens to > > be 20. however when i goto use this variable later i get a type check > > failure saying the variable is {50,48,10}. I know this converts to 20 > > but i have forgotten how to convert it so that i can use it. can > > someone please remind me. thanks > > > > > -- > MrTrick > >
6. Re: parsing a txt file
- Posted by Patrick Barnes <mrtrick at gmail.com> Nov 25, 2004
- 726 views
On Thu, 25 Nov 2004 14:34:35 +1000, spent memory <spent.memory at gmail.com> wrote: > > what do u mean, to strip the line feed ascii?? , i used the method > earlier posted by jason and it seems to work fine Huh? not once did I mention stripping the line feed char off the string. You don't need to get rid of excess chars... value("12345ABCDEF") will return {success, 12345} -- MrTrick
7. Re: parsing a txt file
- Posted by "Kat" <gertie at visionsix.com> Nov 25, 2004
- 753 views
On 25 Nov 2004, at 14:06, spent memory wrote: > > i am reading into my program a text file. in this text file i seek to > a certain line and assign 1 of my variables the value which happens to > be 20. however when i goto use this variable later i get a type check > failure saying the variable is {50,48,10}. I know this converts to 20 > but i have forgotten how to convert it so that i can use it. can > someone please remind me. thanks I do 1000's of pages of html per day of text extraction and parsing, and i have no idea what you are talking about. How do you get sequence {50,48,10} from an atom 20? If the one line is "20\r", i can see that happening. Why not just grab the whole file and then use parseddata = parse(data,{10,13}) or parseddata = parse(data,{'\r','\n'}) ? Then line one is parseddata[1], line 50 is parseddata[50], etc. Kat
8. Re: parsing a txt file
- Posted by spent memory <spent.memory at gmail.com> Nov 25, 2004
- 742 views
the file is an ascii txt file i am parsing. i am also trying not to use any external libraries other than what i need because i want to be in control of the speed. when i read in the file using gets i read the entire thing in. if i print the file i get a seies of ascii keycodes. if i puts the file i see it as it is in notepad. surely you know what this is Kat??? , besides problem solved now anyway! On Thu, 25 Nov 2004 03:06:33 -0600, Kat <gertie at visionsix.com> wrote: > > > On 25 Nov 2004, at 14:06, spent memory wrote: > > > > > i am reading into my program a text file. in this text file i seek to > > a certain line and assign 1 of my variables the value which happens to > > be 20. however when i goto use this variable later i get a type check > > failure saying the variable is {50,48,10}. I know this converts to 20 > > but i have forgotten how to convert it so that i can use it. can > > someone please remind me. thanks > > I do 1000's of pages of html per day of text extraction and parsing, and i > have > no idea what you are talking about. How do you get sequence {50,48,10} > from an atom 20? If the one line is "20\r", i can see that happening. Why not > just grab the whole file and then use > > parseddata = parse(data,{10,13}) > or > parseddata = parse(data,{'\r','\n'}) > > ? Then line one is parseddata[1], line 50 is parseddata[50], etc. > > Kat > > > This email was sent to: spent.memory at gmail.com > > >