Tips Week 2.2 - Trimming Names in LotusScript
If you thought yesterday's tip was simple, check this out.
Have you ever written code of questionable quality like this?
FullName = doc.FirstName(0) if doc.MiddleInitial(0) <> "" then FullName = FullName + doc.MiddleInitial(0) end if FullName = FullName + " " + doc.LastName(0)
I know I've been guilty of coding like this in the past. There must be an easier way to work out full names for users? Well, yeah, you can use FullTrim() to remove duplicate spaces and so the following would do just fine:
FullTrim( doc.FirstName(0)+ " " + doc.MiddleInitial(0) + " " + doc.LastName(0))
More simple tips to follow...
Comments
Add your own response here:
Although your email address isn't required it is protected from spambots if you choose to provide it and not to hide it. My right to remove commercial, irrelevant or posts I just don't like is reserved.

However when you use fulltrim in a scheduled agent on many many documents, this function causes a memory leak
Really? Doh. The following would do too:
Trim( doc.FirstName(0)+ " " + doc.MiddleInitial(0)) + " " + doc.LastName(0)
Really -- in the R5 code stream (fixed in 5.0.9, if I recall correctly).