want to display dynamic field name on screen but with updating initial as capital and adding one space in between.Field name always start with small caps
eg. "indiaChinaFrance" to "India China France"
eg. abcDefXyz to "Abc Def Xyz"
Discussion posts and replies are publicly visible
#JobSecurity
It is a beautiful piece of code though! Not sure I even knew the proper() function existed until now..
Might as well include my solution here also
a!localVariables( local!input: "indiaChinaFrance", joinarray( a!forEach( items: enumerate(len(local!input)), expression: a!localVariables( local!char: charat(local!input,fv!index), if( fv!isFirst, upper(local!char), if( code(local!char)<97, concat(" ",local!char), local!char ) ) ) ) ) )
index( index( index( reduce( merge( apply( index( if( merge( merge( ...
*shudder*
As I feel the community pressure here: my shot:
a!localVariables( local!countryString: "indiaChinaFrance", local!brackets: append( a!forEach( items: enumerate(len(local!countryString))+1, expression: a!localVariables( local!charUnicode: code(charat(local!countryString,fv!index)), if( and( local!charUnicode=<90, local!charUnicode>=65 ), fv!item, {} ) ) ), len(local!countryString) ), a!forEach( items: local!brackets, expression: if( fv!isFirst, concat(upper(charat(local!countryString,1)),mid(local!countryString,2,fv!item-2)), if( fv!isLast, mid(local!countryString,local!brackets[fv!index-1],fv!item+1-local!brackets[fv!index-1]), mid(local!countryString,local!brackets[fv!index-1],fv!item-local!brackets[fv!index-1]) ) ) ) )
okaaaay its not really easier than stefans
Sorry I'm late in the party but also want to contribute.
I like your idea to use regex Selva. That is my idea:
a!localVariables( local!a: "indiaChinaFrance", local!b: regexinsertmatchmarkers("([A-Z])", local!a, " ", null, false(), "g"), local!b )
Acacio B.