1. parsing a txt file

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

new topic     » topic index » view message » categorize

2. Re: parsing a txt file

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.

new topic     » goto parent     » topic index » view message » categorize

3. Re: parsing a txt file

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.
> 
> 
> 
>

new topic     » goto parent     » topic index » view message » categorize

4. Re: parsing a txt file

{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

new topic     » goto parent     » topic index » view message » categorize

5. Re: parsing a txt file

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
> 
>

new topic     » goto parent     » topic index » view message » categorize

6. Re: parsing a txt file

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

new topic     » goto parent     » topic index » view message » categorize

7. Re: parsing a txt file

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

new topic     » goto parent     » topic index » view message » categorize

8. Re: parsing a txt file

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
> 
> 
>

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu