更新时间:2023-11-09 23:48:40
将数组保存在局部变量中,并使用数组的 length
字段查找其长度。一个用于说明它是基于0的:
Save the array in a local variable and use the array's length
field to find its length. Subtract one to account for it being 0-based:
String[] bits = one.split("-");
String lastOne = bits[bits.length-1];