converting ß.cfg to upper case using toUpperCase() in java

前端 未结 5 1311
心在旅途
心在旅途 2021-01-18 05:47

I am trying following code

String s1 = \"ß.cfg\";
System.out.println (s.toUpperCase());

output I am getting is SS.CFG since U

5条回答
  •  清歌不尽
    2021-01-18 06:30

    The documentation for toUpperCase( Locale ) explicitly states that this is what will happen:

    Since case mappings are not always 1:1 char mappings, the resulting String may be a different length than the original String.

    small letter sharp s -> two letters: SS

提交回复
热议问题