Re: DELIMITED DATA FILES TO SEQUENCE

new topic     » goto parent     » topic index » view thread      » older message » newer message

ZNorQ wrote:
> 
> I've known about Euphoria for a long time now, but it is untill now
> i've tried to learn it. Looks quite powerful, and what I like most
> is the SEQUENCEs.
> 
> As I make quite a few utilities for workrelated tasks, I was thinking
> of going over to Euphoria instead of using O'Basic (which is really
> easy, yet quite powerful.) in hope that Euphoria can help me out 
> better than the restrictions in O'Basic's arrays. Euphoria is a new
> way of thinking, and I haven't quite gotten used to it yet! :D
> 
> What I'm looking for is an include file that can read a data file 
> (text format - where data is placed in a record/field structure 
> separated by a special delim. character, like TAB, ';' etc.)
> and build a SEQUENCE from that file.
> 
> An example of the content of a file, where [TAB] is the char(9);
> HEADING ONE [TAB] HEADING TWO [TAB] HEADING THREE
> DATA ONE    [TAB] DATA TWO    [TAB] DATA THREE
> DATA ONE    [TAB] DATA TWO    [TAB] DATA THREE
> 
> the result would be;
> {
> {"HEADING ONE", "HEADING TWO", "HEADING THREE"},          -- Record 1
> {"DATA ONE", "DATA TWO", "DATA THREE"},                   -- Record 2
> {"DATA ONE", "DATA TWO", "DATA THREE"}                    -- Record 3
> }
> 
> This will be used to view this data for example in Win32Lib's
> List View control. (I know how to do that! :D)
> 
> I'd probably make it work if really I put my head into it, but right now
> im trying to absorb as much as possible about the language, and I'm
> spending most of my time getting to know Win32Lib.
> 
> What I would like to know is if any of you know if a code snippet
> of this sort already exists?
> 
> Kenneth 'ZNorQ'
> 
global function read_LV(integer id)
    sequence lData,lheads,line,row
        integer cnt,fh
          fh=1
          line={}
          row={}
      -- Output the columns in the right order
      lheads = getColumnHeadings(id)
      for i = 1 to getLVCount(id) do
          for j = 1 to length(lheads) do--the minus one to cut off last col
              lData = getLVItemText(id, i, lheads[j][1])
      line=append(line,lData)
            -- line=line & lData
          end for
           row =append(row,line)
           line={}
      end for
    return row
  end function

don cole
SF

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu