Does anyone have a good Proper Case algorithm

前端 未结 13 1210
一生所求
一生所求 2020-12-15 04:03

Does anyone have a trusted Proper Case or PCase algorithm (similar to a UCase or Upper)? I\'m looking for something that takes a value such as \"GEORGE BURDELL\"

13条回答
  •  伪装坚强ぢ
    2020-12-15 04:46

    You do not mention which language you would like the solution in so here is some pseudo code.

    Loop through each character
        If the previous character was an alphabet letter
            Make the character lower case
        Otherwise
            Make the character upper case
    End loop
    

提交回复
热议问题