DuckDocs

Structs

Extensions

Extension

on String

these are the main string utilities of the duck std library

Extension Methods

Method

len

fn() -> Int

returns the length of the string self

Method

count

fn() -> Int

returns the count of actual utf8 runes in the string

Method

is_empty

fn() -> Bool

returns if the string is empty

Method

contains

fn(substr: String) -> Bool

returns if the string contains the given substr

Method

starts_with

fn(prefix: String) -> Bool

returns if the string starts with given prefix

Method

ends_with

fn(suffix: String) -> Bool

returns if the string ends with the given suffix

Method

index_of

fn(substr: String) -> Int | .none

returns the index of the given substr or .none if not found

Method

to_upper

fn() -> String

returns the string in uppercase

Method

to_lower

fn() -> String

returns the string in lowercase

Method

trim

fn() -> String

returns the string with trimmed space at the beginning and end of the string

Method

replace

fn(old_s: String, new_s: String) -> String

returns the string with given old_s replaced with given new_s

Method

substring

fn(start: Int, end: Int) -> String | .err_out_of_bounds

returns a substring of the string

Method

repeat

fn(count: Int) -> String

returns the string repeated

Method

to_int

fn() -> Int | .err_parsing

returns the string as a int or .err_parsing if couldn't parse to int

Method

to_bytes

fn() -> Int[]

returns a byte array of the string

Extension

on String

these are the main string utilities of the duck std library

Extension Methods

Method

len

fn() -> Int

returns the length of the string self

Method

count

fn() -> Int

returns the count of actual utf8 runes in the string

Method

is_empty

fn() -> Bool

returns if the string is empty

Method

contains

fn(substr: String) -> Bool

returns if the string contains the given substr

Method

starts_with

fn(prefix: String) -> Bool

returns if the string starts with given prefix

Method

ends_with

fn(suffix: String) -> Bool

returns if the string ends with the given suffix

Method

index_of

fn(substr: String) -> Int | .none

returns the index of the given substr or .none if not found

Method

to_upper

fn() -> String

returns the string in uppercase

Method

to_lower

fn() -> String

returns the string in lowercase

Method

trim

fn() -> String

returns the string with trimmed space at the beginning and end of the string

Method

replace

fn(old_s: String, new_s: String) -> String

returns the string with given old_s replaced with given new_s

Method

substring

fn(start: Int, end: Int) -> String | .err_out_of_bounds

returns a substring of the string

Method

repeat

fn(count: Int) -> String

returns the string repeated

Method

to_int

fn() -> Int | .err_parsing

returns the string as a int or .err_parsing if couldn't parse to int

Method

to_bytes

fn() -> Int[]

returns a byte array of the string

Global Functions

Fn

string_____to_int

fn(x: String) -> Int

returns x in uppercase

Fn

std_____string_____to_int

fn(x: String) -> Int

returns x in uppercase