What's the difference between Character.toUpperCase() and Character.toTitleCase()

前端 未结 2 1969
再見小時候
再見小時候 2021-02-19 21:16

I was refactoring some of my old code and then I found out that I\'d used Character.toTitleCase() method at some point and couldn\'t help myself wondering if

2条回答
  •  -上瘾入骨i
    2021-02-19 22:23

    I don't really see any "real" differences here and I think it's best not to overthink small details. I wanna point out this only line here which should help with the "issue" here.

    In general, String.toUpperCase() should be used to map characters to uppercase. String case mapping methods have several benefits over Character case mapping methods.

    Documentation String.toUpperCase(): https://www.w3schools.com/jsref/jsref_touppercase.asp

    Someone else should comment if they have more inside information.

提交回复
热议问题