Convert NotesName Format via LS

Mindwatering Incorporated

Author: Tripp W Black

Created: 08/30/2006 at 01:48 PM

 

Category:
Notes Developer Tips
LotusScript

Function below converts passed name to canonical, abbreviated, or common name (cn) format.
ConvertName.txt

Note:
In Lotus R8, ConvertName has become a built-in function. To use this one, rename function to LSConvertName or similar.


Below is one that can handle a list:
%REM
Function NameConvertLstCommon
Description: variation to process list of names
%END REM
Function NameConvertLstCommon(incomingstr As String) As String
' process incomingstr and return outstr w/common name
Dim tmpLst As Variant ' list to hold split
Dim outstr As String ' returned string with common name
Dim outdelim As String ' list deliminator
Dim tmpName As NotesName

On Error GoTo FunctionErrorHandler

If (InStr(incomingstr, ";")) Then
tmpLst = Split(incomingstr, ";")
outdelim = ";"
Else
If (InStr(incomingstr, "<br>")) Then
tmpLst = Split(incomingstr, "<br>")
outdelim = "<br>"
Else
' give up
NameConvertLstCommon = incomingstr
Exit Function
End If
End If
outstr = ""
ForAll vals In tmpLst
Set tmpName = New NotesName(CStr(vals))
If Not (tmpName Is Nothing) Then
If (outstr="") Then
' first value
outstr = tmpName.Common
Else
outstr = outstr & outdelim & tmpName.Common
End If
End If

End ForAll
NameConvertLstCommon = outstr
Exit Function

FunctionErrorHandler:
NameConvertLstCommon = ""
Exit Function

End Function


previous page