更新时间:2023-02-14 18:38:08
尝试做:
rackingSystem = rackingSystem.toLowerCase();
而不是:
rackingSystem.toLowerCase();
字符串是不可变的,你必须重新分配的结果toLowerCase()
。
Strings are immutable, you must reassign the result of toLowerCase()
.
虽然更容易,(只要您的字符串大于长度2):
Easier though, (as long as your String is larger than length 2):
rackingSystem = rackingSystem.substring(0,1).toUpperCase() + rackingSystem.substring(1).toLowerCase();