logo

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

    • avatar
    • Remko
    • Tue 14 Mar 2006 07:23 AM

    However when you use fulltrim in a scheduled agent on many many documents, this function causes a memory leak

    • avatar
    • Jake
    • Tue 14 Mar 2006 07:31 AM

    Really? Doh. The following would do too:

    Trim( doc.FirstName(0)+ " " + doc.MiddleInitial(0)) + " " + doc.LastName(0)

  1. Really -- in the R5 code stream (fixed in 5.0.9, if I recall correctly).

Your Comments

Name:
E-mail:
(optional)
Website:
(optional)
Comment:


About This Page

Written by Jake Howlett on Tue 14 Mar 2006

Share This Page

# ( ) '

Comments

The most recent comments added:

Skip to the comments or add your own.

You can subscribe to an individual RSS feed of comments on this entry.

Let's Get Social


About This Website

CodeStore is all about web development. Concentrating on Lotus Domino, ASP.NET, Flex, SharePoint and all things internet.

Your host is Jake Howlett who runs his own web development company called Rockall Design and is always on the lookout for new and interesting work to do.

You can find me on Twitter and on Linked In.

Read more about this site »

Elsewhere

Here are the external links posted on the same day.

More links are available in the archive »

More Content