Then I came up with this code, a doctoring of some from the FAQ section of this BB.
From a first-name-first @fullname, this code splits out first and last names, removes the MI-followed-by-period from the first name (if present) and gets you two or three initials as the result.
code:
$splitbetweennames = instr(@fullname," ")
if instr(@fullname,". ")
$splitbetweennames = instr(@fullname,". ")
endif
$firstname = substr(@fullname,1,$splitbetweennames)
$firstnametemp = $firstname
if instr(@fullname,". ")
$firstnametemp = substr(@fullname,1,len($firstnametemp)-3)
endif
? "First name, no MI: " $firstnametemp
$lastname = ltrim(substr(@fullname,$splitbetweennames+1,len(@fullname)-$splitbetweennames))
? "Last name: " + $lastname
$firstinitial = ltrim(substr(@fullname,1,1))
$middleinitial=("")
if instr(@fullname,".")
$middleinitial=ltrim(substr($firstname,len($firstname)-2,2))
endif
$lastinitial = ltrim(substr($lastname,1,1))
? "initials: " + $firstinitial + $middleinitial + $lastinitial