AnsweredAssumed Answered

Calculation loop

Question asked by Frinholp on Aug 11, 2010
Latest reply on Aug 12, 2010 by philmodjunk


Calculation loop


I am trying to write a calculation that converts text in a field so that the first character of each word is capitalised. I don't want to use the Proper function as this does not allow for uppercase in the middle of words.

I have got this far:

$Word = Upper (Left ( $Word ; 1 ))  &  Right ( $Word ; Length ( $Word ) -1 )

This will set the first character of a word to uppercase. I now need to loop this for the amount of words in the field. I can get the number of words in the field using WordCount  and  retrieve a words using  LeftWords and RightWords but I need to loop this. I dont know how so set this loop:


For ($i = 1 to Wordcount ( $Scentence ))


$Word = Get Word ( $Sentence;   $i);

$Word = Upper (Left ( $Word ; 1 ))  &  Right ( $Word ; Length ( $Word ) -1 );

Set Word ( $Sentence; $i);

$i = $i + 1;


Any help appreciated