Proper() not capitalizing Names with special characters

Certified Associate Developer

Hi All,

I'm not having the desired result when using proper() with words including special characters.  We receive the error when the user's name has special characters. 

EXP)  O'Neal is being saved as O'neal, Aube-Kubel as Aube-kubel, etc.

I need to implement a rule for capitalizing letters after special characters, but not sure how to proceed.  Any assistance is appreciated, thanks!

  Discussion posts and replies are publicly visible

Parents
  • As another option with OOTB functions, you can create your own expression rule that determines which characters should be translated to upper case.  In this example, we maintain a list of characters that determine that the following character should be upper case (space, dash, apostrophe, etc).

    a!localVariables(
      local!chars: {"'"," ","-"}, /* Any leading char that determins upper next */
      local!capIndex: reject(
        fn!isnull,
        a!forEach(
          items: 1+enumerate(len(ri!string)),
          expression: if(
            or(
              fv!isFirst,
              contains(local!chars,charat(ri!string,fv!index))
            ),
            if(fv!isFirst,1,fv!index+1),
            null
          )
        )
      ),
      
      concat(
        a!forEach(
          items: 1+enumerate(len(ri!string)),
          expression: if(
            contains(local!capIndex,fv!index),
            upper(charat(ri!string,fv!index)),
            charat(ri!string,fv!index)
          )
        )
      )
    )

Reply
  • As another option with OOTB functions, you can create your own expression rule that determines which characters should be translated to upper case.  In this example, we maintain a list of characters that determine that the following character should be upper case (space, dash, apostrophe, etc).

    a!localVariables(
      local!chars: {"'"," ","-"}, /* Any leading char that determins upper next */
      local!capIndex: reject(
        fn!isnull,
        a!forEach(
          items: 1+enumerate(len(ri!string)),
          expression: if(
            or(
              fv!isFirst,
              contains(local!chars,charat(ri!string,fv!index))
            ),
            if(fv!isFirst,1,fv!index+1),
            null
          )
        )
      ),
      
      concat(
        a!forEach(
          items: 1+enumerate(len(ri!string)),
          expression: if(
            contains(local!capIndex,fv!index),
            upper(charat(ri!string,fv!index)),
            charat(ri!string,fv!index)
          )
        )
      )
    )

Children
No Data