Lotus NotesStream如何逐个字符地读取

时间:2014-05-08 05:15:18

标签: lotus-domino lotusscript

如何逐字符地从NotesStream中读取。即一个循环中的一个字符。 NoteasStream.Read(1)读取一个字符,但返回一个我无法转换为特定字符的变量数组。

1 个答案:

答案 0 :(得分:3)

这样你就可以从流

逐字节读取
Dim stream As NotesStream
Dim bytes As variant
...
Do
    bytes = stream.Read(1)
    Print bytes(0)
Loop Until stream.IsEOS

从流

一次读取多于一个字节的效率可能更高效
Dim stream As NotesStream
Dim bytes As variant
...
Do
    bytes = stream.Read(32767)
    ForAll b In bytes
        Print b
    End ForAll
Loop Until stream.IsEOS

如果你想逐个获取字符而不是字节,那么你可以使用这个

Dim stream As NotesStream
...
Dim buffer As String
Dim i As Long
Dim char As String
buffer = stream.ReadText()
For i=1 To Len(buffer)
    char = Mid(buffer, i, 1)
    Print char
Next