package core:bytes

⌘K
Ctrl+K
or
/

    Overview

    Procedures for manipulation of []byte slices.

    Index

    Types (2)
    Constants (1)
    Variables (0)

    This section is empty.

    Procedures (125)
    Procedure Groups (0)

    This section is empty.

    Types

    Constants

    Variables

    This section is empty.

    Procedures

    alias ¶

    alias :: proc "contextless" (a, b: []u8) -> bool {…}
     

    alias returns true iff a and b have a non-zero length, and any part of a overlaps with b.

    alias_inexactly ¶

    alias_inexactly :: proc "contextless" (a, b: []u8) -> bool {…}
     

    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_capacity ¶

    buffer_capacity :: proc(b: ^Buffer) -> int {…}

    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_is_empty ¶

    buffer_is_empty :: proc(b: ^Buffer) -> bool {…}

    buffer_length ¶

    buffer_length :: proc(b: ^Buffer) -> int {…}

    buffer_next ¶

    buffer_next :: proc(b: ^Buffer, n: int) -> []u8 {…}

    buffer_read ¶

    buffer_read :: proc(b: ^Buffer, p: []u8) -> (n: int, err: io.Error) {…}

    buffer_read_at ¶

    buffer_read_at :: proc(b: ^Buffer, p: []u8, offset: int) -> (n: int, err: io.Error) {…}

    buffer_read_byte ¶

    buffer_read_byte :: proc(b: ^Buffer) -> (u8, io.Error) {…}

    buffer_read_bytes ¶

    buffer_read_bytes :: proc(b: ^Buffer, delim: u8) -> (line: []u8, err: io.Error) {…}

    buffer_read_from ¶

    buffer_read_from :: proc(b: ^Buffer, r: io.Stream) -> (n: i64, err: io.Error) {…}

    buffer_read_ptr ¶

    buffer_read_ptr :: proc(b: ^Buffer, ptr: rawptr, size: int) -> (n: int, err: io.Error) {…}

    buffer_read_rune ¶

    buffer_read_rune :: proc(b: ^Buffer) -> (r: rune, size: int, err: io.Error) {…}

    buffer_read_slice ¶

    buffer_read_slice :: proc(b: ^Buffer, slice: $S/[]$T) -> (n: int, err: io.Error) {…}

    buffer_read_string ¶

    buffer_read_string :: proc(b: ^Buffer, delim: u8) -> (line: string, err: io.Error) {…}

    buffer_reset ¶

    buffer_reset :: proc(b: ^Buffer) {…}

    buffer_seek ¶

    buffer_seek :: proc(b: ^Buffer, offset: i64, whence: io.Seek_From) -> (i64, io.Error) {…}

    buffer_to_bytes ¶

    buffer_to_bytes :: proc(b: ^Buffer) -> []u8 {…}

    buffer_to_stream ¶

    buffer_to_stream :: proc(b: ^Buffer) -> (s: io.Stream) {…}

    buffer_to_string ¶

    buffer_to_string :: proc(b: ^Buffer) -> string {…}

    buffer_truncate ¶

    buffer_truncate :: proc(b: ^Buffer, n: int) {…}

    buffer_unread_byte ¶

    buffer_unread_byte :: proc(b: ^Buffer) -> io.Error {…}

    buffer_unread_rune ¶

    buffer_unread_rune :: proc(b: ^Buffer) -> io.Error {…}

    buffer_write ¶

    buffer_write :: proc(b: ^Buffer, p: []u8, loc := #caller_location) -> (n: int, err: io.Error) {…}

    buffer_write_at ¶

    buffer_write_at :: proc(
    	b:      ^Buffer, 
    	p:      []u8, 
    	offset: int, 
    	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_ptr ¶

    buffer_write_ptr :: proc(
    	b:    ^Buffer, 
    	ptr:  rawptr, 
    	size: int, 
    	loc := #caller_location, 
    ) -> (n: int, err: io.Error) {…}

    buffer_write_rune ¶

    buffer_write_rune :: proc(
    	b:   ^Buffer, 
    	r:   rune, 
    	loc := #caller_location, 
    ) -> (n: int, err: io.Error) {…}

    buffer_write_slice ¶

    buffer_write_slice :: proc(
    	b:     ^Buffer, 
    	slice: $S/[]$T, 
    	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) {…}

    buffer_write_to ¶

    buffer_write_to :: proc(b: ^Buffer, w: io.Stream) -> (n: i64, 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, 
    	loc := #caller_location, 
    ) -> []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 ¶

    compare :: proc(lhs, rhs: []u8) -> int {…}
     

    Compares two []byte, returning a value representing which one comes first lexiographically. Returns: -1 for lhs, 1 for rhs, or 0 if they are equal.

    concatenate ¶

    concatenate :: proc(
    	a:         [][]u8, 
    	allocator := context.allocator, 
    	loc := #caller_location, 
    ) -> []u8 {…}

    concatenate_safe ¶

    concatenate_safe :: proc(
    	a:         [][]u8, 
    	allocator := context.allocator, 
    	loc := #caller_location, 
    ) -> (data: []u8, err: runtime.Allocator_Error) {…}

    contains ¶

    contains :: proc(s, substr: []u8) -> bool {…}

    contains_any ¶

    contains_any :: proc(s, chars: []u8) -> bool {…}

    contains_rune ¶

    contains_rune :: proc(s: []u8, r: rune) -> int {…}

    count ¶

    count :: proc(s, substr: []u8) -> int {…}

    equal ¶

    equal :: proc(a, b: []u8) -> bool {…}

    equal_fold ¶

    equal_fold :: proc(u, v: []u8) -> bool {…}

    expand_tabs ¶

    expand_tabs :: proc(
    	s:         []u8, 
    	tab_size:  int, 
    	allocator := context.allocator, 
    	loc := #caller_location, 
    ) -> []u8 {…}

    fields ¶

    fields :: proc(s: []u8, allocator := context.allocator, loc := #caller_location) -> [][]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, 
    	loc := #caller_location, 
    ) -> [][]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

    has_prefix ¶

    has_prefix :: proc(s, prefix: []u8) -> bool {…}

    has_suffix ¶

    has_suffix :: proc(s, suffix: []u8) -> bool {…}

    index ¶

    index :: proc(s, substr: []u8) -> int {…}

    index_any ¶

    index_any :: proc(s, chars: []u8) -> int {…}

    index_byte ¶

    index_byte :: proc "contextless" (s: []u8, c: u8) -> (index: int) {…}
     

    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.

    index_proc ¶

    index_proc :: proc(s: []u8, p: proc(rune) -> bool, truth: bool = true) -> int {…}

    index_proc_with_state ¶

    index_proc_with_state :: proc(
    	s:     []u8, 
    	p:     proc(rawptr, rune) -> bool, 
    	state: rawptr, 
    	truth: bool = true, 
    ) -> int {…}

    index_rune ¶

    index_rune :: proc(s: []u8, r: rune) -> int {…}

    is_ascii_space ¶

    is_ascii_space :: proc(r: rune) -> bool {…}

    is_in_cutset ¶

    is_in_cutset :: proc(state: rawptr, r: rune) -> bool {…}

    is_null ¶

    is_null :: proc(r: rune) -> bool {…}

    is_space ¶

    is_space :: proc(r: rune) -> bool {…}

    join ¶

    join :: proc(
    	a:         [][]u8, 
    	sep:       []u8, 
    	allocator := context.allocator, 
    	loc := #caller_location, 
    ) -> []u8 {…}

    join_safe ¶

    join_safe :: proc(
    	a:         [][]u8, 
    	sep:       []u8, 
    	allocator := context.allocator, 
    	loc := #caller_location, 
    ) -> (data: []u8, err: runtime.Allocator_Error) {…}

    last_index ¶

    last_index :: proc(s, substr: []u8) -> int {…}

    last_index_any ¶

    last_index_any :: proc(s, chars: []u8) -> int {…}

    last_index_byte ¶

    last_index_byte :: proc "contextless" (s: []u8, c: u8) -> int {…}
     

    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.

    last_index_proc ¶

    last_index_proc :: proc(s: []u8, p: proc(rune) -> bool, truth: bool = true) -> int {…}

    last_index_proc_with_state ¶

    last_index_proc_with_state :: proc(
    	s:     []u8, 
    	p:     proc(rawptr, rune) -> bool, 
    	state: rawptr, 
    	truth: bool = true, 
    ) -> int {…}

    left_justify ¶

    left_justify :: proc(
    	str:       []u8, 
    	length:    int, 
    	pad:       []u8, 
    	allocator := context.allocator, 
    	loc := #caller_location, 
    ) -> []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

    partition ¶

    partition :: proc(str, sep: []u8) -> (head, match, tail: []u8) {…}

    ptr_from_bytes ¶

    ptr_from_bytes :: proc(str: []u8) -> ^u8 {…}

    reader_init ¶

    reader_init :: proc(r: ^Reader, s: []u8) -> io.Stream {…}

    reader_length ¶

    reader_length :: proc(r: ^Reader) -> int {…}

    reader_read ¶

    reader_read :: proc(r: ^Reader, p: []u8) -> (n: int, err: io.Error) {…}

    reader_read_at ¶

    reader_read_at :: proc(r: ^Reader, p: []u8, off: i64) -> (n: int, err: io.Error) {…}

    reader_read_byte ¶

    reader_read_byte :: proc(r: ^Reader) -> (u8, io.Error) {…}

    reader_read_ptr ¶

    reader_read_ptr :: proc(r: ^Reader, data: rawptr, len: int) -> (n: int, err: io.Error) {…}

    reader_read_ptr_at ¶

    reader_read_ptr_at :: proc(
    	r:    ^Reader, 
    	data: rawptr, 
    	len:  int, 
    	off:  i64, 
    ) -> (n: int, err: io.Error) {…}

    reader_read_rune ¶

    reader_read_rune :: proc(r: ^Reader) -> (ch: rune, size: int, err: io.Error) {…}

    reader_read_slice ¶

    reader_read_slice :: proc(r: ^Reader, slice: $T/[]$S) -> (n: int, err: io.Error) {…}

    reader_read_slice_at ¶

    reader_read_slice_at :: proc(r: ^Reader, slice: $T/[]$S, off: i64) -> (n: int, err: io.Error) {…}

    reader_seek ¶

    reader_seek :: proc(r: ^Reader, offset: i64, whence: io.Seek_From) -> (i64, io.Error) {…}

    reader_size ¶

    reader_size :: proc(r: ^Reader) -> i64 {…}

    reader_to_stream ¶

    reader_to_stream :: proc(r: ^Reader) -> (s: io.Stream) {…}

    reader_unread_byte ¶

    reader_unread_byte :: proc(r: ^Reader) -> io.Error {…}

    reader_unread_rune ¶

    reader_unread_rune :: proc(r: ^Reader) -> io.Error {…}

    reader_write_to ¶

    reader_write_to :: proc(r: ^Reader, w: io.Stream) -> (n: i64, err: io.Error) {…}

    remove ¶

    remove :: proc(
    	s, key:    []u8, 
    	n:         int, 
    	allocator := context.allocator, 
    	loc := #caller_location, 
    ) -> (output: []u8, was_allocation: bool) {…}

    remove_all ¶

    remove_all :: proc(
    	s, key:    []u8, 
    	allocator := context.allocator, 
    	loc := #caller_location, 
    ) -> (output: []u8, was_allocation: bool) {…}

    repeat ¶

    repeat :: proc(
    	s:         []u8, 
    	count:     int, 
    	allocator := context.allocator, 
    	loc := #caller_location, 
    ) -> []u8 {…}

    replace ¶

    replace :: proc(
    	s, old, new: []u8, 
    	n:           int, 
    	allocator := context.allocator, 
    	loc := #caller_location, 
    ) -> (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, 
    	loc := #caller_location, 
    ) -> (output: []u8, was_allocation: bool) {…}

    reverse ¶

    reverse :: proc(s: []u8, allocator := context.allocator, loc := #caller_location) -> []u8 {…}

    right_justify ¶

    right_justify :: proc(
    	str:       []u8, 
    	length:    int, 
    	pad:       []u8, 
    	allocator := context.allocator, 
    	loc := #caller_location, 
    ) -> []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

    rune_count ¶

    rune_count :: proc(s: []u8) -> int {…}

    scrub ¶

    scrub :: proc(
    	s:           []u8, 
    	replacement: []u8, 
    	allocator := context.allocator, 
    	loc := #caller_location, 
    ) -> []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, loc := #caller_location) -> [][]u8 {…}

    split_after ¶

    split_after :: proc(
    	s, sep:    []u8, 
    	allocator := context.allocator, 
    	loc := #caller_location, 
    ) -> [][]u8 {…}

    split_after_iterator ¶

    split_after_iterator :: proc(s: ^[]u8, sep: []u8) -> ([]u8, bool) {…}

    split_after_n ¶

    split_after_n :: proc(
    	s, sep:    []u8, 
    	n:         int, 
    	allocator := context.allocator, 
    	loc := #caller_location, 
    ) -> [][]u8 {…}

    split_iterator ¶

    split_iterator :: proc(s: ^[]u8, sep: []u8) -> ([]u8, bool) {…}

    split_multi ¶

    split_multi :: proc(
    	s:          []u8, 
    	substrs:    [][]u8, 
    	skip_empty: bool = false, 
    	allocator := context.allocator, 
    	loc := #caller_location, 
    ) -> [][]u8 {…}

    split_multi_iterator ¶

    split_multi_iterator :: proc(
    	s:          ^[]u8, 
    	substrs:    [][]u8, 
    	skip_empty: bool = false, 
    ) -> ([]u8, bool) {…}

    split_n ¶

    split_n :: proc(
    	s, sep:    []u8, 
    	n:         int, 
    	allocator := context.allocator, 
    	loc := #caller_location, 
    ) -> [][]u8 {…}

    trim ¶

    trim :: proc(s: []u8, cutset: []u8) -> []u8 {…}

    trim_left ¶

    trim_left :: proc(s: []u8, cutset: []u8) -> []u8 {…}

    trim_left_null ¶

    trim_left_null :: proc(s: []u8) -> []u8 {…}

    trim_left_proc ¶

    trim_left_proc :: proc(s: []u8, p: proc(rune) -> bool) -> []u8 {…}

    trim_left_proc_with_state ¶

    trim_left_proc_with_state :: proc(
    	s:     []u8, 
    	p:     proc(rawptr, rune) -> bool, 
    	state: rawptr, 
    ) -> []u8 {…}

    trim_left_space ¶

    trim_left_space :: proc(s: []u8) -> []u8 {…}

    trim_null ¶

    trim_null :: proc(s: []u8) -> []u8 {…}

    trim_prefix ¶

    trim_prefix :: proc(s, prefix: []u8) -> []u8 {…}

    trim_right ¶

    trim_right :: proc(s: []u8, cutset: []u8) -> []u8 {…}

    trim_right_null ¶

    trim_right_null :: proc(s: []u8) -> []u8 {…}

    trim_right_proc ¶

    trim_right_proc :: proc(s: []u8, p: proc(rune) -> bool) -> []u8 {…}

    trim_right_proc_with_state ¶

    trim_right_proc_with_state :: proc(
    	s:     []u8, 
    	p:     proc(rawptr, rune) -> bool, 
    	state: rawptr, 
    ) -> []u8 {…}

    trim_right_space ¶

    trim_right_space :: proc(s: []u8) -> []u8 {…}

    trim_space ¶

    trim_space :: proc(s: []u8) -> []u8 {…}

    trim_suffix ¶

    trim_suffix :: proc(s, suffix: []u8) -> []u8 {…}

    truncate_to_byte ¶

    truncate_to_byte :: proc(str: []u8, b: u8) -> []u8 {…}

    truncate_to_rune ¶

    truncate_to_rune :: proc(str: []u8, r: rune) -> []u8 {…}

    Procedure Groups

    This section is empty.

    Source Files

    Generation Information

    Generated with odin version dev-2026-10 (vendor "odin") Windows_amd64 @ 2026-10-10 00:25:51.511820200 +0000 UTC