String functions

0
Hi .I have String like as Mendix Rapid .I want output like MR..if I add another word to that  string  output will be M and first  charcter of the last word .means Mendix Rapid Developer output will be MD.How can do this     thanks in advance 
asked
2 answers
1

With just String Function Calls that would be:
 

FirstInitial = substring(InputString, 0, 1)
LastSpacePosition = findLast(InputString, ' ')
SecondInitial = substring(InputString, LastSpacePosition + 1, 1)
Output = FirstInitial + SecondInitial

or in one piece

substring($Person/Name, 0, 1) + substring($Person/Name, findLast($Person/Name, ' ') + 1, 1)

 

answered
0

Try the RegexReplaceAll java function in the CommunityCommons module. As needleRegex, use:

(.).*\b(.).*

And as replacement, use:

$1$2

This will remember the first character as $1 and the first character after the last word boundary as $2.

Input: John Fitzgerald Kennedy

Output: JK

answered