关于在lotus domino中分割字符串的问题!
来源:互联网 发布:ios 开发传数据接口 编辑:程序博客网 时间:2024/04/29 19:44
以前用lotus domino为客户写的办公自动化程序,出了问题
发现用lotus的@contains函数存在问题,当要判断的字符串太大时,就会报错.
这是以前的写法:
NotesMacro$="@contains("""+sendto+""";"","")"
Dim flag As Variant
flag=Evaluate(NotesMacro$) '当sendto很大时,这句话会报错误,导致执行不下去
'当发送多个用户时,先将文本串转换成文本列表,在赋值
If flag(0) Then
NotesMacro$ = "@Explode("""+sendto+""";"","")"
mailDoc.sendto =Evaluate(NotesMacro$)
Else
mailDoc.sendto=sendto
End If
这是修改后的写法:
先写一个分割字符串的函数:
Function ParseString(StringToParse As String,Delim As String) As Variant
' Returns an array containing the results of parsing
' a string based on the specified delimiter.
' If StringToParse or Delim is empty returns Null
' If Len(Delim) >= Len(StringToParse returns Null
' If StringToParse does not contain the delimiter, returns
' the entire string.
Dim a() As String
Dim s As String
Dim DelimPos As Integer
Dim count As Integer
If Len(StringToParse) = 0 Or Len(Delim) = 0 Then
ParseString = Null
Exit Function
End If
If Len(Delim) >= Len(StringToParse) Then
ParseString = Null
Exit Function
End If
DelimPos = Instr(1, StringToParse, Delim)
If DelimPos = 0 Then
Redim a(0)
a(0) = StringToParse
ParseString = a
Exit Function
End If
s = StringToParse
count = 0
Do
Redim Preserve a(count)
a(count) = Left(s, DelimPos - 1)
s = Right(s, Len(s) - (DelimPos + Len(Delim) - 1))
count = count + 1
DelimPos = Instr(1, s, Delim)
If DelimPos = 0 Then
Redim Preserve a(count)
a(count) = s
s = ""
End If
Loop Until Len(s) = 0
ParseString = a
End Function
然后将上面的语句修改为:
mailDoc.sendto=ParseString(sendto,",")
问题解决!
发现用lotus的@contains函数存在问题,当要判断的字符串太大时,就会报错.
这是以前的写法:
NotesMacro$="@contains("""+sendto+""";"","")"
Dim flag As Variant
flag=Evaluate(NotesMacro$) '当sendto很大时,这句话会报错误,导致执行不下去
'当发送多个用户时,先将文本串转换成文本列表,在赋值
If flag(0) Then
NotesMacro$ = "@Explode("""+sendto+""";"","")"
mailDoc.sendto =Evaluate(NotesMacro$)
Else
mailDoc.sendto=sendto
End If
这是修改后的写法:
先写一个分割字符串的函数:
Function ParseString(StringToParse As String,Delim As String) As Variant
' Returns an array containing the results of parsing
' a string based on the specified delimiter.
' If StringToParse or Delim is empty returns Null
' If Len(Delim) >= Len(StringToParse returns Null
' If StringToParse does not contain the delimiter, returns
' the entire string.
Dim a() As String
Dim s As String
Dim DelimPos As Integer
Dim count As Integer
If Len(StringToParse) = 0 Or Len(Delim) = 0 Then
ParseString = Null
Exit Function
End If
If Len(Delim) >= Len(StringToParse) Then
ParseString = Null
Exit Function
End If
DelimPos = Instr(1, StringToParse, Delim)
If DelimPos = 0 Then
Redim a(0)
a(0) = StringToParse
ParseString = a
Exit Function
End If
s = StringToParse
count = 0
Do
Redim Preserve a(count)
a(count) = Left(s, DelimPos - 1)
s = Right(s, Len(s) - (DelimPos + Len(Delim) - 1))
count = count + 1
DelimPos = Instr(1, s, Delim)
If DelimPos = 0 Then
Redim Preserve a(count)
a(count) = s
s = ""
End If
Loop Until Len(s) = 0
ParseString = a
End Function
然后将上面的语句修改为:
mailDoc.sendto=ParseString(sendto,",")
问题解决!
- 关于在lotus domino中分割字符串的问题!
- 在C语言中分割字符串
- oracle中分割字符串的方法
- c#中分割字符串的方法
- c#中分割字符串的方法
- C#中分割字符串的方法
- VC中分割字符串的AfxExtractSubString函数
- VC中分割字符串的AfxExtractSubString函数
- VC中分割字符串的AfxExtractSubString函数
- VC中分割字符串的AfxExtractSubString函数
- VC中分割字符串的AfxExtractSubString函数
- sql 中分割字符串的方法
- MS_SQL中分割字符串
- c#中分割字符串
- sql中分割字符串
- c#中分割字符串
- sql 中分割字符串
- sql中分割字符串
- CV bbs
- AJAX会取代桌面系统吗?(译文)
- 哈哈,我又回来了
- 即时通讯市场狼烟四起,jabber标准搅局中国(转载)
- 在ASP.NET页面间传递任意数据的方法与实例
- 关于在lotus domino中分割字符串的问题!
- 与人相处的12条准则
- swt-design破解for Eclipse3.1
- 近期开发计划:简单的邮件发送接受RCP程序
- IIS 6.0的设置和排错
- 职业病
- 掌握 Ajax,第 1 部分: Ajax 简介
- MFC绘图--使用不同DC
- 行业还有高尚与卑鄙之分吗?