dart:core
庫中BigInt.toRadixString
方法的用法介紹如下。
用法:
String toRadixString(
int radix
)
將 this 轉換為給定 radix
中的字符串表示形式。
在字符串表示中,'9' 以上的數字使用小寫字母,'a' 為 10,'z' 為 35。
radix
參數必須是 2 到 36 範圍內的整數。
例子:
// Binary (base 2).
print(BigInt.from(12).toRadixString(2)); // 1100
print(BigInt.from(31).toRadixString(2)); // 11111
print(BigInt.from(2021).toRadixString(2)); // 11111100101
print(BigInt.from(-12).toRadixString(2)); // -1100
// Octal (base 8).
print(BigInt.from(12).toRadixString(8)); // 14
print(BigInt.from(31).toRadixString(8)); // 37
print(BigInt.from(2021).toRadixString(8)); // 3745
// Hexadecimal (base 16).
print(BigInt.from(12).toRadixString(16)); // c
print(BigInt.from(31).toRadixString(16)); // 1f
print(BigInt.from(2021).toRadixString(16)); // 7e5
// Base 36.
print(BigInt.from(35 * 36 + 1).toRadixString(36)); // z1
相關用法
- Dart BigInt.toDouble用法及代碼示例
- Dart BigInt.toInt用法及代碼示例
- Dart BigInt.toUnsigned用法及代碼示例
- Dart BigInt.toString用法及代碼示例
- Dart BigInt.toSigned用法及代碼示例
- Dart BigInt.tryParse用法及代碼示例
- Dart BigInt.operator_divide用法及代碼示例
- Dart BigInt.from用法及代碼示例
- Dart BigInt.isValidInt用法及代碼示例
- Dart BigInt.parse用法及代碼示例
- Dart BigInt.bitLength用法及代碼示例
- Dart BigInt.gcd用法及代碼示例
- Dart BigInt.operator_truncate_divide用法及代碼示例
- Dart BigInt.compareTo用法及代碼示例
- Dart BigInt.remainder用法及代碼示例
- Dart BigInt.operator_modulo用法及代碼示例
- Dart BigInt.pow用法及代碼示例
- Dart BigInt用法及代碼示例
- Dart Base64Encoder用法及代碼示例
- Dart ByteData.view用法及代碼示例
- Dart ByteData用法及代碼示例
- Dart Base64Decoder用法及代碼示例
- Dart MapMixin.containsKey用法及代碼示例
- Dart Iterator用法及代碼示例
- Dart AttributeClassSet.intersection用法及代碼示例
注:本文由純淨天空篩選整理自dart.dev大神的英文原創作品 toRadixString method。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。