package core:strconv

Types

Decimal_Slice ¶

Decimal_Slice :: struct {
	digits:        []u8,
	count:         int,
	decimal_point: int,
	neg:           bool,
}

Float_Info ¶

Float_Info :: struct {
	mantbits: uint,
	expbits:  uint,
	bias:     int,
}

Int_Flag ¶

Int_Flag :: enum int {
	Prefix, 
	Plus, 
	Space, 
}

Int_Flags ¶

Int_Flags :: bit_set[Int_Flag]

Constants

MAX_BASE ¶

MAX_BASE :: 32

Variables

digits ¶

digits: string = …

Procedures

append_bits ¶

append_bits :: proc "odin" (
	buf:       []u8, 
	x:         u64, 
	base:      int, 
	is_signed: bool, 
	bit_size:  int, 
	digits:    string, 
) -> string {…}

append_bits_128 ¶

append_bits_128 :: proc "odin" (
	buf:       []u8, 
	x:         u128, 
	base:      int, 
	is_signed: bool, 
	bit_size:  int, 
	digits:    string, 
) -> string {…}

append_bool ¶

append_bool :: proc "odin" (buf: []u8, b: bool) -> string {…}

append_float ¶

append_float :: proc "odin" (buf: []u8, f: f64, fmt: u8, prec, bit_size: int) -> string {…}

append_int ¶

append_int :: proc "odin" (buf: []u8, i: i64, base: int) -> string {…}

append_uint ¶

append_uint :: proc "odin" (buf: []u8, u: u64, base: int) -> string {…}

atof ¶

atof :: proc "odin" (s: string) -> f64 {…}

atoi ¶

atoi :: proc "odin" (path: string) -> int {…}

format_digits ¶

format_digits :: proc "odin" (
	buf:       []u8, 
	shortest:  bool, 
	neg:       bool, 
	digs:      Decimal_Slice, 
	precision: int, 
) -> []u8 {…}

generic_ftoa ¶

generic_ftoa :: proc "odin" (buf: []u8, val: f64, fmt: u8, precision, bit_size: int) -> []u8 {…}

is_integer_negative ¶

is_integer_negative :: proc "odin" (x: u64, is_signed: bool, bit_size: int) -> (u: u64, neg: bool) {…}

is_integer_negative_128 ¶

is_integer_negative_128 :: proc "odin" (x: u128, is_signed: bool, bit_size: int) -> (u: u128, neg: bool) {…}

itoa ¶

itoa :: proc "odin" (buf: []u8, i: int) -> string {…}

parse_bool ¶

parse_bool :: proc "odin" (s: string, n: ^int = nil) -> (result: bool = false, ok: bool) {…}

parse_f32 ¶

parse_f32 :: proc "odin" (s: string, n: ^int = nil) -> (value: f32, ok: bool) {…}
 

Parses a 32-bit floating point number from a string.

Returns ok=false if a base 10 float could not be found, or if the input string contained more than just the number.

``` n, ok := strconv.parse_f32("12.34eee"); assert(n == 12.34 && ok);

n, ok = strconv.parse_f32("12.34"); assert(n == 12.34 && ok); ```

parse_f64 ¶

parse_f64 :: proc "odin" (str: string, n: ^int = nil) -> (value: f64, ok: bool) {…}
 

Parses a 64-bit floating point number from a string.

Returns ok=false if a base 10 float could not be found, or if the input string contained more than just the number.

``` n, ok := strconv.parse_f32("12.34eee"); assert(n == 12.34 && ok);

n, ok = strconv.parse_f32("12.34"); assert(n == 12.34 && ok); ```

parse_i128_maybe_prefixed ¶

parse_i128_maybe_prefixed :: proc "odin" (str: string, n: ^int = nil) -> (value: i128, ok: bool) {…}
 

Parses a integer value from a string, in base 10, unless there's a prefix.

Returns ok=false if a valid integer could not be found, or if the input string contained more than just the number.

``` n, ok := strconv.parse_i128_maybe_prefixed("1234"); assert(n == 1234 && ok);

n, ok = strconv.parse_i128_maybe_prefixed("0xeeee"); assert(n == 0xeeee && ok); ```

parse_i128_of_base ¶

parse_i128_of_base :: proc "odin" (str: string, base: int, n: ^int = nil) -> (value: i128, ok: bool) {…}
 

Parses an integer value from a string, in the given base, without a prefix.

Returns ok=false if no numeric value of the appropriate base could be found, or if the input string contained more than just the number.

``` n, ok := strconv.parse_i128_of_base("-1234eeee", 10); assert(n == -1234 && ok); ```

parse_i64_maybe_prefixed ¶

parse_i64_maybe_prefixed :: proc "odin" (str: string, n: ^int = nil) -> (value: i64, ok: bool) {…}
 

Parses a integer value from a string, in base 10, unless there's a prefix.

Returns ok=false if a valid integer could not be found, or if the input string contained more than just the number.

``` n, ok := strconv.parse_i64_maybe_prefixed("1234"); assert(n == 1234 && ok);

n, ok = strconv.parse_i64_maybe_prefixed("0xeeee"); assert(n == 0xeeee && ok); ```

parse_i64_of_base ¶

parse_i64_of_base :: proc "odin" (str: string, base: int, n: ^int = nil) -> (value: i64, ok: bool) {…}
 

Parses an integer value from a string, in the given base, without a prefix.

Returns ok=false if no numeric value of the appropriate base could be found, or if the input string contained more than just the number.

``` n, ok := strconv.parse_i64_of_base("-1234eeee", 10); assert(n == -1234 && ok); ```

parse_int ¶

parse_int :: proc "odin" (s: string, base: int = 0, n: ^int = nil) -> (value: int, ok: bool) {…}
 

Parses an integer value from a string in the given base, or - if the string has a prefix (e.g: '0x') then that will determine the base; - otherwise, assumes base 10.

Returns ok=false if no appropriate value could be found, or if the input string contained more than just the number.

``` n, ok := strconv.parse_int("1234"); // without prefix, inferred base 10 assert(n == 1234 && ok);

n, ok = strconv.parse_int("ffff", 16); // without prefix, explicit base assert(n == 0xffff && ok);

n, ok = strconv.parse_int("0xffff"); // with prefix and inferred base assert(n == 0xffff && ok); ```

parse_u128_maybe_prefixed ¶

parse_u128_maybe_prefixed :: proc "odin" (str: string, n: ^int = nil) -> (value: u128, ok: bool) {…}
 

Parses an unsigned integer value from a string in base 10, unless there's a prefix.

Returns ok=false if a valid integer could not be found, if the value was negative, or if the input string contained more than just the number.

``` n, ok := strconv.parse_u128_maybe_prefixed("1234"); assert(n == 1234 && ok);

n, ok = strconv.parse_u128_maybe_prefixed("0xeeee"); assert(n == 0xeeee && ok); ```

parse_u128_of_base ¶

parse_u128_of_base :: proc "odin" (str: string, base: int, n: ^int = nil) -> (value: u128, ok: bool) {…}
 

Parses an unsigned integer value from a string, in the given base, and without a prefix.

Returns ok=false if no numeric value of the appropriate base could be found, or if the input string contained more than just the number.

``` n, ok := strconv.parse_u128_of_base("1234eeee", 10); assert(n == 1234 && ok);

n, ok = strconv.parse_u128_of_base("5678eeee", 16); assert(n == 0x5678eeee && ok); ```

parse_u64_maybe_prefixed ¶

parse_u64_maybe_prefixed :: proc "odin" (str: string, n: ^int = nil) -> (value: u64, ok: bool) {…}
 

Parses an unsigned integer value from a string in base 10, unless there's a prefix.

Returns ok=false if a valid integer could not be found, if the value was negative, or if the input string contained more than just the number.

``` n, ok := strconv.parse_u64_maybe_prefixed("1234"); assert(n == 1234 && ok);

n, ok = strconv.parse_u64_maybe_prefixed("0xeeee"); assert(n == 0xeeee && ok); ```

parse_u64_of_base ¶

parse_u64_of_base :: proc "odin" (str: string, base: int, n: ^int = nil) -> (value: u64, ok: bool) {…}
 

Parses an unsigned integer value from a string, in the given base, and without a prefix.

Returns ok=false if no numeric value of the appropriate base could be found, or if the input string contained more than just the number.

``` n, ok := strconv.parse_u64_of_base("1234eeee", 10); assert(n == 1234 && ok);

n, ok = strconv.parse_u64_of_base("5678eeee", 16); assert(n == 0x5678eeee && ok); ```

parse_uint ¶

parse_uint :: proc "odin" (s: string, base: int = 0, n: ^int = nil) -> (value: uint, ok: bool) {…}
 

Parses an unsigned integer value from a string in the given base, or - if the string has a prefix (e.g: '0x') then that will determine the base; - otherwise, assumes base 10.

Returns ok=false if: - no appropriate value could be found; or - the value was negative. - the input string contained more than just the number.

``` n, ok := strconv.parse_uint("1234"); // without prefix, inferred base 10 assert(n == 1234 && ok);

n, ok = strconv.parse_uint("ffff", 16); // without prefix, explicit base assert(n == 0xffff && ok);

n, ok = strconv.parse_uint("0xffff"); // with prefix and inferred base assert(n == 0xffff && ok); ```

quote ¶

quote :: proc "odin" (buf: []u8, str: string) -> string {…}

quote_rune ¶

quote_rune :: proc "odin" (buf: []u8, r: rune) -> string {…}

round_shortest ¶

round_shortest :: proc "odin" (d: ^strconv_decimal.Decimal, mant: u64, exp: int, flt: ^Float_Info) {…}

unquote_char ¶

unquote_char :: proc "odin" (str: string, quote: u8) -> (r: rune, multiple_bytes: bool, tail_string: string, success: bool) {…}

unquote_string ¶

unquote_string :: proc "odin" (lit: string, allocator := context.allocator) -> (res: string, allocated, success: bool) {…}

Procedure Groups

Source Files

Generation Information

Generated with odin version dev-2022-10 (vendor "odin") Windows_amd64 @ 2022-10-06 21:11:36.862835700 +0000 UTC