Android Feature/Debug 笔记

1⃣️高效与可读性的取舍:
(高效)

public static String initialCapitalization(String str){
        char[] convertChar = str.toCharArray();
        if(convertChar.length > 1){
            if(convertChar[0] >= 'a' && convertChar[0] <= 'z'){
                convertChar[0] = (char)(convertChar[0] - 32);
            }

            for(int i = 1; i < convertChar.length; i++){
                convertChar[i] = (char)(convertChar[i] + 32);
            }
        }
        return String.valueOf(convertChar);
    }

(可读性)

public static String initialCapitalization(String str){
        return str.substring(0,1) + str.substring(1).toLowerCase();
    }

2⃣️Android Language Difference:

<plurals name="inventory_device_count_unit">
        <item quantity="one">asset</item>
        <item quantity="other">assets</item>
    </plurals>

    <plurals name="inventory_device_size_hint">
        <item quantity="zero">This inventory is done.</item>
        <item quantity="one">%d device remains to be inventoried.</item>
        <item quantity="other">%d devices remain to be inventoried.</item>
    </plurals>

(中文)
只进other,因为中文不分单复数;
(英文)
进one和other;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值