[Zope] firstname/lastname and string manipulation

Chris Beaumont cbeaumon@msri.org
Sun, 13 May 2001 17:36:51 -0700


Hello,

   I've got a very long list of names that comes from a column in an 
SQL table, and that column needs to be broken into a first name and a 
last name.. Because it is in a sense, a space-delimited field, I'm 
trying that route first.

Not all of the names are in the standard format..

I'm using a dtml-in to loop through the returned records from an SQL query..

Within that loop, I'm using <dtml-var "_.string.split(SPEAKER,' 
')[0]"> to successfully display the 'first name' (really the first 
part of the string) but when trying to use

<dtml-var "_.string.split(SPEAKER,' ')[1]">

to display the part after the first space, even when I wrap that in a dtml-if
  I get an IndexError / list index out of range..

Does anyone have an obvious answer to what I'm doing wrong?

Thank you,
Chris