convert
Installation
SKILL.md
仓颉标准库类型转换 Skill
导入:
import std.convert.*
1. Parsable<T> — 字符串解析为指定类型
public interface Parsable<T> {
static func parse(value: String): T // 失败抛 IllegalArgumentException
static func tryParse(value: String): Option<T> // 失败返回 None
}
1.1 已实现类型
Bool, Rune, Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64, Float16, Float32, Float64