computer 版 (精华区)
发信人: windoe (为中国电信做贡献), 信区: program
标 题: VB:如何从一个字符串中读取一行字符?
发信站: 听涛站 (Fri Mar 10 19:09:11 2000), 转信
Function ReadStringLine(src_str As String, lineno As Integer) As String
On Error Resume Next
Dim string_flag As Integer
Dim line_cnt As Integer
Dim test_string As String
Dim ret_string As String
line_cnt = 0 '初始--> 行数为1
string_flag = 1 '标志为1
test_string = Right(src_str, 2)
If test_string <> vbCrLf Then
test_string = src_str + vbCrLf
Else
test_string = src_str
End If
DoEvents
Do
line_cnt = line_cnt + 1
string_flag = InStr(test_string, vbCrLf)
ret_string = Left(test_string, string_flag)
test_string = Right(test_string, Len(test_string) - string_flag - 1)
Loop Until lineno <= line_cnt
'If line_cnt = 1 Then
' ReadStringLine = ret_string
ne_cnt
'If line_cnt = 1 Then
' ReadStringLine = ret_string
'Else
ReadStringLine = Left(ret_string, Len(ret_string) - 1)
'End If
End Function
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:0.770毫秒