Il mercoledì 6 maggio 2009 15:01:45 richard terry ha scritto:
> See the attached file for the data. Unfortunately I'm brain dead when it
> comes to simple logic.
>
> In one of my hl7 messages in the Free Text segment under an actual
> pathology result, there is a list of sequential bood test results
> representing previous results of the same type - , separated by tabs which
> I need to display properly. as I've re-constructed the result as html, the
> tabs simply disappear in the result, so I've been looking for a solution,
> and to start I thought maybe I could split this up into lines and then
> later put it into a table embedded in the html to keep it aligned.
>
> Perhaps there is a simple way out, but this is what I've done so far.
>
>
> So I started with this:
>
> 1) Split this into lines
>
> Dim bits as string[]
> dim a_line as string
>
> bits = split(the_text_in_the_file,"<BR>,"", TRUE)
>
> for each a_line in bits
>       print a_line
> next
>
> Problem with this is that the \t (I presume tab character) gets in the way,
> and it dosn't split properly with the results of the bits[] as shown in the
> picture. Interestingly an occasional letter is lost off the test names.
>
> Any help appreciated.
>
> richard

You can't use "<BR>" as a separator , because "<BR>" is a list of separators. 
This is why you miss some letters, Eg. "R"esults, "B"icarb.
I will do a substitution with Replace$ to have a uniq splitting char. (I 
used "@")
eg.:

PUBLIC SUB Main()
    
    DIM bits AS string[] 
    DIM a_line AS String
    DIM sReplacedText AS String

   sReplacedText = Replace$(File.Load("sample_tabbed_text"), "<BR>", "@")  
   
   bits = Split(sReplacedText, "@", "", TRUE)

   FOR EACH a_line IN bits
       PRINT a_line 
   NEXT

END

Saluti,

Stefano

------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
Gambas-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to