package core:bytes
Index
Constants (1)
Variables (0)
This section is empty.
Procedures (119)
- alias
- alias_inexactly
- buffer_capacity
- buffer_destroy
- buffer_grow
- buffer_init
- buffer_init_allocator
- buffer_init_string
- buffer_is_empty
- buffer_length
- buffer_next
- buffer_read
- buffer_read_at
- buffer_read_byte
- buffer_read_bytes
- buffer_read_from
- buffer_read_ptr
- buffer_read_rune
- buffer_read_string
- buffer_reset
- buffer_seek
- buffer_to_bytes
- buffer_to_stream
- buffer_to_string
- buffer_truncate
- buffer_unread_byte
- buffer_unread_rune
- buffer_write
- buffer_write_at
- buffer_write_byte
- buffer_write_ptr
- buffer_write_rune
- buffer_write_string
- buffer_write_to
- center_justify
- centre_justify
- clone
- clone_safe
- compare
- concatenate
- concatenate_safe
- contains
- contains_any
- contains_rune
- count
- equal
- equal_fold
- expand_tabs
- fields
- fields_proc
- has_prefix
- has_suffix
- index
- index_any
- index_byte
- index_proc
- index_proc_with_state
- index_rune
- is_ascii_space
- is_in_cutset
- is_null
- is_space
- join
- join_safe
- last_index
- last_index_any
- last_index_byte
- last_index_proc
- last_index_proc_with_state
- left_justify
- partition
- ptr_from_bytes
- ptr_from_slice
- reader_init
- reader_length
- reader_read
- reader_read_at
- reader_read_byte
- reader_read_rune
- reader_seek
- reader_size
- reader_to_stream
- reader_unread_byte
- reader_unread_rune
- reader_write_to
- remove
- remove_all
- repeat
- replace
- replace_all
- reverse
- right_justify
- rune_count
- scrub
- split
- split_after
- split_after_iterator
- split_after_n
- split_iterator
- split_multi
- split_multi_iterator
- split_n
- trim
- trim_left
- trim_left_null
- trim_left_proc
- trim_left_proc_with_state
- trim_left_space
- trim_null
- trim_prefix
- trim_right
- trim_right_null
- trim_right_proc
- trim_right_proc_with_state
- trim_right_space
- trim_space
- trim_suffix
- truncate_to_byte
- truncate_to_rune
Procedure Groups (0)
This section is empty.
Types
Buffer ¶
A Buffer is a variable-sized buffer of bytes with a io.Stream interface The zero value for Buffer is an empty buffer ready to use.
Related Procedures With Parameters
- buffer_capacity
- buffer_destroy
- buffer_grow
- buffer_init
- buffer_init_allocator
- buffer_init_string
- buffer_is_empty
- buffer_length
- buffer_next
- buffer_read
- buffer_read_at
- buffer_read_byte
- buffer_read_bytes
- buffer_read_from
- buffer_read_ptr
- buffer_read_rune
- buffer_read_string
- buffer_reset
- buffer_seek
- buffer_to_bytes
- buffer_to_stream
- buffer_to_string
- buffer_truncate
- buffer_unread_byte
- buffer_unread_rune
- buffer_write
- buffer_write_at
- buffer_write_byte
- buffer_write_ptr
- buffer_write_rune
- buffer_write_string
- buffer_write_to
Reader ¶
Related Procedures With Parameters
Constants
MIN_READ ¶
MIN_READ :: 512
Variables
This section is empty.
Procedures
alias ¶
alias returns true iff a and b have a non-zero length, and any part of a overlaps with b.
alias_inexactly ¶
alias_inexactly returns true iff a and b have a non-zero length,
the base pointer of a and b are NOT equal, and any part of a overlaps
with b (ie: alias(a, b)
with an exception that returns false for
a == b
, b = a[:len(a)-69]
and similar conditions).
buffer_destroy ¶
buffer_destroy :: proc(b: ^Buffer) {…}
buffer_grow ¶
buffer_grow :: proc(b: ^Buffer, n: int, loc := #caller_location) {…}
buffer_init ¶
buffer_init :: proc(b: ^Buffer, buf: []u8, loc := #caller_location) {…}
buffer_init_allocator ¶
buffer_init_allocator :: proc(b: ^Buffer, len, cap: int, allocator := context.allocator, loc := #caller_location) {…}
buffer_init_string ¶
buffer_init_string :: proc(b: ^Buffer, s: string, loc := #caller_location) {…}
buffer_reset ¶
buffer_reset :: proc(b: ^Buffer) {…}
buffer_write ¶
buffer_write :: proc(b: ^Buffer, p: []u8, loc := #caller_location) -> (n: int, err: io.Error) {…}
buffer_write_byte ¶
buffer_write_byte :: proc(b: ^Buffer, c: u8, loc := #caller_location) -> io.Error {…}
buffer_write_rune ¶
buffer_write_rune :: proc(b: ^Buffer, r: rune, loc := #caller_location) -> (n: int, err: io.Error) {…}
buffer_write_string ¶
buffer_write_string :: proc(b: ^Buffer, s: string, loc := #caller_location) -> (n: int, err: io.Error) {…}
center_justify ¶
center_justify :: centre_justify
centre_justify returns a byte slice with a pad byte slice at boths sides if the str's rune length is smaller than length
centre_justify ¶
centre_justify :: proc(str: []u8, length: int, pad: []u8, allocator := context.allocator) -> []u8 {…}
centre_justify returns a byte slice with a pad byte slice at boths sides if the str's rune length is smaller than length
clone ¶
clone :: proc(s: []u8, allocator := context.allocator, loc := #caller_location) -> []u8 {…}
clone_safe ¶
clone_safe :: proc(s: []u8, allocator := context.allocator, loc := #caller_location) -> (data: []u8, err: runtime.Allocator_Error) {…}
compare ¶
Compares two strings, returning a value representing which one comes first lexiographically.
-1 for a
; 1 for b
, or 0 if they are equal.
concatenate ¶
concatenate :: proc(a: [][]u8, allocator := context.allocator) -> []u8 {…}
concatenate_safe ¶
concatenate_safe :: proc(a: [][]u8, allocator := context.allocator) -> (data: []u8, err: runtime.Allocator_Error) {…}
expand_tabs ¶
expand_tabs :: proc(s: []u8, tab_size: int, allocator := context.allocator) -> []u8 {…}
fields ¶
fields :: proc(s: []u8, allocator := context.allocator) -> [][]u8 {…}
fields splits the byte slice s around each instance of one or more consecutive white space character, defined by unicode.is_space returning a slice of subslices of s or an empty slice if s only contains white space
fields_proc ¶
fields_proc :: proc(s: []u8, f: proc(rune) -> bool, allocator := context.allocator) -> [][]u8 {…}
fields_proc splits the byte slice s at each run of unicode code points ch
satisfying f(ch)
returns a slice of subslices of s
If all code points in s satisfy f(ch) or string is empty, an empty slice is returned
fields_proc makes no guarantee about the order in which it calls f(ch)
it assumes that f
always returns the same value for a given ch
index_byte ¶
Scan a slice of bytes for a specific byte.
This procedure safely handles slices of any length, including empty slices.
Inputs:
data: A slice of bytes.
c: The byte to search for.
Returns:
index: The index of the byte c
, or -1 if it was not found.
join_safe ¶
join_safe :: proc(a: [][]u8, sep: []u8, allocator := context.allocator) -> (data: []u8, err: runtime.Allocator_Error) {…}
last_index_byte ¶
Scan a slice of bytes for a specific byte, starting from the end and working backwards to the start.
This procedure safely handles slices of any length, including empty slices.
Inputs:
data: A slice of bytes.
c: The byte to search for.
Returns:
index: The index of the byte c
, or -1 if it was not found.
left_justify ¶
left_justify :: proc(str: []u8, length: int, pad: []u8, allocator := context.allocator) -> []u8 {…}
left_justify returns a byte slice with a pad byte slice at left side if the str's rune length is smaller than length
ptr_from_slice ¶
ptr_from_slice :: ptr_from_bytes
remove ¶
remove :: proc(s, key: []u8, n: int, allocator := context.allocator) -> (output: []u8, was_allocation: bool) {…}
remove_all ¶
remove_all :: proc(s, key: []u8, allocator := context.allocator) -> (output: []u8, was_allocation: bool) {…}
replace ¶
replace :: proc(s, old, new: []u8, n: int, allocator := context.allocator) -> (output: []u8, was_allocation: bool) {…}
if n < 0, no limit on the number of replacements
replace_all ¶
replace_all :: proc(s, old, new: []u8, allocator := context.allocator) -> (output: []u8, was_allocation: bool) {…}
reverse ¶
reverse :: proc(s: []u8, allocator := context.allocator) -> []u8 {…}
right_justify ¶
right_justify :: proc(str: []u8, length: int, pad: []u8, allocator := context.allocator) -> []u8 {…}
right_justify returns a byte slice with a pad byte slice at right side if the str's rune length is smaller than length
scrub ¶
scrub :: proc(s: []u8, replacement: []u8, allocator := context.allocator) -> []u8 {…}
Scrubs invalid utf-8 characters and replaces them with the replacement string Adjacent invalid bytes are only replaced once
split ¶
split :: proc(s, sep: []u8, allocator := context.allocator) -> [][]u8 {…}
split_after ¶
split_after :: proc(s, sep: []u8, allocator := context.allocator) -> [][]u8 {…}
split_after_n ¶
split_after_n :: proc(s, sep: []u8, n: int, allocator := context.allocator) -> [][]u8 {…}
split_multi ¶
split_multi :: proc(s: []u8, substrs: [][]u8, skip_empty: bool = false, allocator := context.allocator) -> [][]u8 {…}
Procedure Groups
This section is empty.
Source Files
Generation Information
Generated with odin version dev-2024-12 (vendor "odin") Windows_amd64 @ 2024-12-17 21:11:00.879418100 +0000 UTC