Replacing Chr(10) and Chr(13) using script

I have a file attachment which consists of 2 lines.

e.g.

First word, First line

First word, Second line

I am trying to append something to both lines by using:

Print #fileNum, tempString(0)+ |,“myappendstring”|

The result that i’m looking for is:

First word, First line, myappendstring

First word, Second line, myappendstring

However because there seems to be a carriage return at the end of each line, the ‘myappendstring’ is appearing on the next line.

I suppose i’ll need to somehow replace the Chr(10) and Chr(13) with blanks before appending the string.

How can i get rid of the Chr(10) and Chr(13) using lotus script?

Subject: Replacing Chr(10) and Chr(13) using script

It may be easier if you read the file without including the newline characters. To do this, use the “Line Input #” command. This will read a line from the text file, and stop when it finds a newline character.

Hope this helps,

Craig.

Subject: Replacing Chr(10) and Chr(13) using script

Here’s a thing I wrote that takes Chr(10) and Chr(13) out of strings…you can modify it to do what you need…the For/Next loop is what you want

Sub Querysave(Source As Notesuidocument, Continue As Variant)

 Dim workspace                  As New notesuiworkspace

 Dim Doc                               As NotesDocument     

 Dim strConverted               As String     

 Dim strConverted2             As String

 Dim i                                       As Integer     

 Dim TextString                    As String          

 Dim TextString2                  As String

 Set uidoc                               = workspace.currentdocument

 Set doc                                  = uidoc.document

 TextString                             = doc.description(0)          

 TextString2                           = doc.MinQual(0)

 

 For i = 1 To Len(TextString) 

      If Asc(Mid(TextString,i,1)) = Clng(13) Or Asc(Mid(TextString,i,1)) = Clng(10) Then

           strConverted = strConverted + Space(1) 

      Else

           strConverted = strConverted + Mid(TextString,i,1)

      End If          

 Next          

 

 For i = 1 To Len(TextString2) 

      If Asc(Mid(TextString2,i,1)) = Clng(13) Or Asc(Mid(TextString2,i,1)) = Clng(10) Then

           strConverted2 = strConverted2 + Space(1) 

      Else

           strConverted2 = strConverted2 + Mid(TextString2,i,1)

      End If          

 Next          

 

 If  (Doc.HasItem("NoReturn")) Then  

      Call Doc.RemoveItem("NoReturn")          

 End If      

 

 If  (Doc.HasItem("Thursday")) Then                 

      Call Doc.RemoveItem("Thursday")          

 End If      

 

 If  (Doc.HasItem("NoReturn2")) Then                 

      Call Doc.RemoveItem("NoReturn2")          

 End If          

 

 Call doc.AppendItemValue("NoReturn", strConverted)     

 Call doc.AppendItemValue("NoReturn2" , strConverted2)

End Sub

Subject: RE: Replacing Chr(10) and Chr(13) using script

Steven - Many thanks for you “stripper”