Learner - MF string functions

1
Hi, I was trying to replace the first letter of a name field with Capital letter. When I use the command below in MF it replaces it like so Rrupert I have tried various different combinations but cant seem to get it correct. replaceFirst(toLowerCase($name), substring($name,1,0), toUpperCase(substring($name,0,1))) I know I am missing something
asked
2 answers
4

Have you tried toUpperCase(substring($name,0,1))+toLowerCase(substring($name,1))

Edit: I have tested as follows:

toUpperCase(substring($Contact/Attribute,0,1)) + toLowerCase(substring($Contact/Attribute,1))

gives exactly the same results as

replaceFirst(toLowerCase($Contact/Attribute), substring($Contact/Attribute,0,1), toUpperCase(substring($Contact/Attribute,0,1)))

The second one is the method suggested by Bas. Personally, I think the first method is easier to see what's happening, but both work.

answered
1

Shouldn't substring($name, 1, 0) be substring($name, 0, 1) ?

answered