Thankks Norman,
Works great.

I used 
Dim S as string
S =  join(lines, ", ")
EditField10.text = s + "."
and I got the full stop at the end

One part of the code I didn't understand though ...

   dim lines(-1) as string
I see it comes in here
        lines.append line
But how does that work?

Thanks again Norman.
Lennox.



Norman Palardy <[EMAIL PROTECTED]> wrote: 
On Mar 05, 2007, at 4:55 PM, Lennox Jacob wrote:

> Hello,
>
>  I have this code which works well except that when there are less  
> than 8 lines of text (sometimes the number of lines vary in the  
> creation of the file) I would like to prevent the extra commas from  
> coming up and I would like to have the full stop at the end.
>
> Kindly assist.
> Thanks.
> Lennox.
>
> Dim f as folderitem = DocumentsFolder.child("My Temp1 File")
>
>   Dim tis as TextInputStream = f.OpenAsTextFile
>   If tis is nil then
>     //check f.LastErrorCode
>     Return
>   End if
>
>   EditField10.text = tis.ReadLine + ", " + tis.ReadLine + ", " +  
> tis.ReadLine + ", " + tis.ReadLine + ", " + tis.ReadLine + ", " +  
> tis.ReadLine + ", " + tis.ReadLine + ", " + tis.ReadLine + ". "
>
>   tis = nil //the file is closed when the object is destroyed

The way you're doing it with all the readlines when you assign the  
text does not give you much opportunity to do anything different

You need to read in the lines and then join them together in 2 steps  
instead of one like you currently have
Something like

Dim f as folderitem = DocumentsFolder.child("My Temp1 File")

   Dim tis as TextInputStream = f.OpenAsTextFile
   dim i as integer
   dim line as string
   dim lines(-1) as string

   If tis is nil then
     //check f.LastErrorCode
     Return
   End if

   for i = 1 to 8
     line = tis.readline
     if line <> "" then
        lines.append line
     end if
   next

   EditField10.text = join(lines, ", ")

_______________________________________________
Unsubscribe or switch delivery mode:


Search the archives:



 
---------------------------------
Bored stiff? Loosen up...
Download and play hundreds of games for free on Yahoo! Games.
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to