Wolfram: Convert to Binary, Hexadecimal, Base 64, etc.
Integer to String
IntegerString[n]
-
to string.
(* integer to string *) IntegerString[10] === "10" (* True *)
Integer to String, to Binary, Hexadecimal, and other Bases
IntegerString[n,b]
-
to string, in base b. b can be up to 36. a to z is used for digits.
(* binary *) IntegerString[10,2] === "1010" (* True *) (* hexadecimal *) IntegerString[1000,16] === "3e8" (* True *) (* hexadecimal, uppercase *) ToUpperCase @ IntegerString[1000,16] === "3E8" (* True *) (* base 36. max base *) IntegerString[10000, 36] === "7ps" (* True *)
IntegerString[n,b,len]
-
- Return len digits, counting from right.
- If there are more digits, remove extra on left.
- If not enough digits, pad 0 on left.
(* pad with 0 *) IntegerString[1000, 16, 5] (* 003e8 *) (* if padding spec is less than required number of digits, left digits are removed *) IntegerString[1000, 16, 2] (* e8 *)
Integer to String, to Base58, Base64
IntegerString[n,baseSpec]
-
use a special base spec.
(* base 58, bitcoin encoding alphabet *) IntegerString[1000, "Base58"] === "JF" (* True *) (* Base64 *) IntegerString[1000, "Base64"] === "Po" (* True *)
Binary and Hexadecimal String to Number
(* hexadecimal string to decimal number *) FromDigits["f", 16] (* 15 *) FromDigits["fff", 16] (* 4095 *) (* HHHH------------------------------ *) (* binary string to decimal number *) FromDigits["1111", 2] (* 15 *)
Wolfram. Number
Wolfram. String
- Wolfram: String
- Wolfram: String Functions
- Wolfram: Get SubString, by Index
- Wolfram: Get SubString, by Pattern
- Wolfram: Delete SubString
- Wolfram: String Split
- Wolfram: String Join
- Wolfram: String Insert
- Wolfram: Convert to String
- Wolfram: Convert to Binary, Hexadecimal, Base 64, etc.
- Wolfram: String Template
- Wolfram: String Match
- Wolfram: String Replace
- Wolfram: Regular Expression
- Wolfram: String Expression
- Wolfram: StringExpression Pattern Syntax
- Wolfram: RegularExpression vs StringExpression