Kotlin中字符串是有序的字符的集合
用来判断字符串为空
获取字符串中的字符数目
获取指定位置的字符
截取某一段字符串
indexOf()、lastIndexOf()、indices索引范围
舍弃字符串
跟drop对应 拣取
Kolin中用Char类型定义字符君,字符用一堆单引号包含,称为字符字面量
判断是否为数字、判断是否为字符
所谓字符串模板是在字符串中添加若干个占位符,内容会在后期指定,也就是说,用模板可以设置字符串动态的部分。
val name="Mike"
println("hello,$name")
val name="Mike"
println("$name have 5\$s")
val name="Mike"
println("hello,${if(name.isBlank()) name.toUpperCase() else name.toLowerCase()}")
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有