String

package
v0.0.0-...-ec71976 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 29, 2025 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

Package String provides a generic string functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ASCII

func ASCII[S Any](s S) string

ASCII converts ASCII/Latin-1 encoded array to string. Fast alternative to get_string_from_utf8 if the content is ASCII/Latin-1 only. Unlike the UTF-8 function this function maps every byte to a character in the array. Multibyte sequences will not be interpreted correctly. For parsing user input always use UTF8. This is the inverse of ToASCII.

func AddPathElement

func AddPathElement[S Any](s S, file S) S

AddPathElement concatenates file at the end of the string as a subpath, adding / if necessary.

func Append

func Append[S Any, B Any](a S, b B) S

Append returns a new string with the given string appended to the end.

func As

func As[T, S Any](s S) T

func Bigrams

func Bigrams[S Any](s S) iter.Seq[S]

Bigrams returns a sequence of bigrams (pairs of consecutive characters) in this string.

func BinaryToInteger

func BinaryToInteger[S Any](s S) int

BinaryToInteger converts the string representing a binary number into an int. The string may optionally be prefixed with "0b", and an additional - prefix for negative numbers.

func Capitalize

func Capitalize[S Any](s S) S

Capitalize changes the appearance of the string: replaces underscores (_) with spaces, adds spaces before uppercase letters in the middle of a word, converts all letters to lowercase, then converts the first one and each one following a space to uppercase.

func Character

func Character[I Int.Any](chr I) string

Character returns a single Unicode character from the decimal char. You may use unicodelookup.com or unicode.org as points of reference.

func Clean

func Clean[S Any](s S) S

Clean removes all leading and trailing whitespace from the string.

func Comparison

func Comparison[A, B Any](a A, b B) int

Comparison performs a case-sensitive comparison to another string. Returns -1 if less than, 1 if greater than, or 0 if equal. "Less than" and "greater than" are determined by the Unicode code points of each string, which roughly matches the alphabetical order.

With different string lengths, returns 1 if this string is longer than the to string, or -1 if shorter. Note that the length of empty strings is always 0.

To get a bool result from a string comparison, use the == operator instead. See also Comparison, ComparisonStrictNaturalPrioritizePeriodsAndUnderscores, and ComparisonStrictNatural.

func ComparisonIgnoreCasing

func ComparisonIgnoreCasing[A, B Any](a A, b B) int

ComparisonIgnoreCasing performs a case-insensitive comparison to another string. Returns -1 if less than, 1 if greater than, or 0 if equal. "Less than" or "greater than" are determined by the Unicode code points of each string, which roughly matches the alphabetical order. Internally, lowercase characters are converted to uppercase for the comparison.

With different string lengths, returns 1 if this string is longer than the to string, or -1 if shorter. Note that the length of empty strings is always 0.

To get a bool result from a string comparison, use the == operator instead. See also [ComparisonStrict], ComparisonStrictNaturalPrioritizePeriodsAndUnderscores, and ComparisonNatural.

func ComparisonNatural

func ComparisonNatural[S Any](a, b S) int

ComparisonNatural performs a case-insensitive, natural order comparison to another string. Returns -1 if less than, 1 if greater than, or 0 if equal. "Less than" or "greater than" are determined by the Unicode code points of each string, which roughly matches the alphabetical order. Internally, lowercase characters are converted to uppercase for the comparison.

When used for sorting, natural order comparison orders sequences of numbers by the combined value of each digit as is often expected, instead of the single digit's value. A sorted sequence of numbered strings will be ["1", "2", "3", ...], not ["1", "10", "2", "3", ...].

With different string lengths, returns 1 if this string is longer than the to string, or -1 if shorter. Note that the length of empty strings is always 0.

To get a bool result from a string comparison, use the == operator instead. See also ComparisonStrictNatural, ComparisonStrictNaturalPrioritizePeriodsAndUnderscores, and Comparison.

func ComparisonNaturalPrioritizePeriodsAndUnderscores

func ComparisonNaturalPrioritizePeriodsAndUnderscores[S Any](a, b S) int

ComparisonNaturalPrioritizePeriodsAndUnderscores like naturalnocasecmp_to but prioritizes strings that begin with periods (.) and underscores (_) before any other character. Useful when sorting folders or file names.

To get a bool result from a string comparison, use the == operator instead. See also ComparisonStrictNaturalPrioritizePeriodsAndUnderscores, ComparisonNatural, and Comparison.

func ComparisonStrictNatural

func ComparisonStrictNatural[S Any](a, b S) int

ComparisonStrictNatural performs a case-sensitive, natural order comparison to another string. Returns -1 if less than, 1 if greater than, or 0 if equal. "Less than" or "greater than" are determined by the Unicode code points of each string, which roughly matches the alphabetical order.

When used for sorting, natural order comparison orders sequences of numbers by the combined value of each digit as is often expected, instead of the single digit's value. A sorted sequence of numbered strings will be ["1", "2", "3", ...], not ["1", "10", "2", "3", ...].

With different string lengths, returns 1 if this string is longer than the to string, or -1 if shorter. Note that the length of empty strings is always 0.

To get a bool result from a string comparison, use the == operator instead. See also ComparisonNatural, ComparisonNaturalPrioritizePeriodsAndUnderscores, and Comparison.

func ComparisonStrictNaturalPrioritizePeriodsAndUnderscores

func ComparisonStrictNaturalPrioritizePeriodsAndUnderscores[S Any](a, b S) int

ComparisonStrictNaturalPrioritizePeriodsAndUnderscores like ComparisonStrictNatural but prioritizes strings that begin with periods (.) and underscores (_) before any other character. Useful when sorting folders or file names.

To get a bool result from a string comparison, use the == operator instead. See also ComparisonNaturalPrioritizePeriodsAndUnderscores, ComparisonStrictNatural, and [ComparisonStrict].

func Contains

func Contains[A, B Any](what A, s B) bool

Contains returns true if the string contains what, ignoring case. If you need to know where what is within the string, use findn. See also Contains.

func ContainsStrict

func ContainsStrict[S Any](what S, s S) bool

ContainsStrict returns true if the string contains case-sensitive what. If you need to know where what is within the string, use [Find]. See also Contains.

func Count

func Count[D Any, S Any](what D, s S) int

Count returns the number of occurrences of the substring, ignoring case.

func CountStrict

func CountStrict[S Any](what S, s S) int

CountStrict returns the number of occurrences of the case-sensitive substring.

func Decimal

func Decimal[F Float.Any](number F) string

Decimal converts a float to a string representation of a decimal number, with the number of decimal places specified in decimals.

The string representation may only have up to 14 significant digits, with digits before the decimal point having priority over digits after.

Trailing zeros are not included in the string. The last digit is rounded, not truncated.

func DecodeHex

func DecodeHex[S Any](s S) S

DecodeHex decodes a hexadecimal string as a []byte.

func DecodeURI

func DecodeURI[S Any](s S) S

DecodeURI decodes the string from URL-friendly format. This method is meant to properly decode the parameters in a URL when receiving an HTTP request. See also EncodeURI.

func Dedent

func Dedent[S Any](s S) S

Dedent returns a copy of the string with indentation (leading tabs and spaces) removed. See also Indent to add indentation.

func EncodeHex

func EncodeHex[S Any](s S) S

EncodeHex encodes a []byte as a hexadecimal string.

func EncodeURI

func EncodeURI[S Any](s S) S

EncodeURI encodes the string to URL-friendly format. This method is meant to properly encode the parameters in a URL when sending an HTTP request. See also DecodeURI.

func Erase

func Erase[S Any, I Int.Any](position I, s S) S

Erase returns a string with the character erased at position.

func Escape

func Escape[S Any](s S) S

Escape returns a copy of the string with special characters escaped using the Go language standard.

func Extract

func Extract[S Any, D Any, I Int.Any](s S, delimiter D, index I) S

Extract splits the string using a delimiter and returns the substring at index. Returns the original string if delimiter does not occur in the string. Returns an empty string if the element does not exist.

This is faster than split, if you only need one substring.

func ExtractFloats

func ExtractFloats[S Any, D Any](sep D, s S) []Float.X

ExtractFloats splits the string into floats by using a delimiter and returns a [Float.X] slice.

func FileExtension

func FileExtension[S Any](path S) S

FileExtension returns the file extension without the leading period (.) if the string is a valid file name or path. Otherwise, returns an empty string.

func FileName

func FileName[S Any](path S) S

FileName returns the file name, including the extension, if the string is a valid file path,

func FindIndex

func FindIndex[S, V Any](s S, what V) int

FindIndex returns the index of the first occurrence of what in this string, ignoring case. Returns -1 if not found.

func FindLast

func FindLast[S Any, W Any](s S, what W) int

FindLast returns the index of the last occurrence of what in this string, or -1 if there are none. This method is the reverse of [Find].

func FindLastStrict

func FindLastStrict[S Any](s S, what S) int

FindLastStrict returns the index of the last occurrence of what in this string, or -1 if there are none. This method is the reverse of FindStrict.

func FindStrict

func FindStrict[S Any](what S, s S) int

FindStrict returns the index of the first case-sensitive occurrence of what in this string or -1 if not found.

func First

func First[S Any, I Int.Any](n I, s S) S

First, returns the first n characters from the beginning of the string. If length is negative, strips the last length characters from the string's end.

func Format

func Format[S Any](format S, args ...any) S

Format formats the string by replacing all occurrences of placeholder with the elements of values.

Any underscores in placeholder will be replaced with the corresponding keys in advance. Array elements use their index as keys.

Note: The replacement of placeholders is not done all at once, instead each placeholder is replaced in the order they are passed, this means that if one of the replacement strings contains a key it will also be replaced. This can be very powerful, but can also cause unexpected results if you are not careful. If you do not need to perform replacement in the replacement strings, make sure your replacements do not contain placeholders to ensure reliable results.

func HasPrefix

func HasPrefix[S, P Any](s S, prefix P) bool

HasPrefix returns true if the string begins with the given text. See also HasSuffix.

func HasSuffix

func HasSuffix[S, B Any](s S, suffix B) bool

HasSuffix returns true if the string ends with the given text. See also HasSuffix.

func Hash

func Hash[S Any](s S) uint32

Hash Returns the 32-bit hash value representing the string's contents.

Note: Strings with equal hash values are not guaranteed to be the same, as a result of hash collisions. On the contrary, strings with different hash values are guaranteed to be different.

func HexToInteger

func HexToInteger[S Any](s S) int

HexToInteger Converts the string representing a hexadecimal number into an int. The string may be optionally prefixed with "0x", and an additional - prefix for negative numbers.

func HumanReadableSize

func HumanReadableSize(size int) string

HumanReadableSize converts size which represents a number of bytes into a human-readable form.

The result is in IEC prefix format, which may end in either "B", "KiB", "MiB", "GiB", "TiB", "PiB", or "EiB".

func Indent

func Indent[S Any](s, prefix S) S

Indent indents every line of the string with the given prefix. Empty lines are not indented. See also Dedent to remove indentation.

For example, the string can be indented with two tabulations using "\t\t", or four spaces using " ".

func Index

func Index[S Any](s S, i int) byte

Index returns the byte at the given index in the string. If the index is out of range, this function will panic. See also Slice.

func Insert

func Insert[S Any](what, s S, position int) S

Insert inserts what at the given position in the string.

func Integer

func Integer[I Int.Any](number I) string

Integer converts the given number to a string representation.

func IsEmpty

func IsEmpty[S Any](s S) bool

IsEmpty returns true if the string's length is 0 (""). See also length.

func IsStrictSubsequenceOf

func IsStrictSubsequenceOf[S Any](text, s S) bool

IsStrictSubsequenceOf returns true if all characters of this string can be found in text in their original order.

func IsSubsequenceOf

func IsSubsequenceOf[S Any](text, s S) bool

IsSubsequenceOf returns true if all characters of this string can be found in text in any order, ignoring case.

func IsValidFilename

func IsValidFilename[S Any](s S) bool

IsValidFilename returns true if this string does not contain characters that are not allowed in file names (: / \ ? * " | % < >).

func IsValidFloat

func IsValidFloat[S Any](s S) bool

IsValidFloat returns true if this string represents a valid floating-point number. A valid float may contain only digits, one decimal point (.), and the exponent letter (e). It may also be prefixed with a positive (+) or negative (-) sign. Any valid integer is also a valid float (see IsValidInt). See also ToFloat.

func IsValidHexColor

func IsValidHexColor[S Any](s S) bool

IsValidHexColor Returns true if this string is a valid color in hexadecimal HTML notation. The string must be a hexadecimal value (see is_valid_hex_number) of either 3, 4, 6 or 8 digits, and may be prefixed by a hash sign (#). Other HTML notations for colors, such as names or hsl(), are not considered valid.

func IsValidHexNumber

func IsValidHexNumber[S Any](s S) bool

IsValidHexNumber returns true if this string is a valid hexadecimal number. A valid hexadecimal number only contains digits or letters A to F (either uppercase or lowercase), and may be prefixed with a positive (+) or negative (-) sign.

func IsValidIdentifier

func IsValidIdentifier[S Any](s S) bool

IsValidIdentifier returns true if this string is a valid identifier. A valid identifier may contain only letters, digits and underscores (_), and the first character may not be a digit.

func IsValidInt

func IsValidInt[S Any](s S) bool

IsValidInt returns true if this string represents a valid integer. A valid integer only contains digits, and may be prefixed with a positive (+) or negative (-) sign. See also ToInt.

func IsValidInternetProtocolAddress

func IsValidInternetProtocolAddress[S Any](s S) bool

IsValidInternetProtocolAddress returns true if this string represents a well-formatted IPv4 or IPv6 address. This method considers reserved IP addresses such as "0.0.0.0" and "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff" as valid.

func JoinedWith

func JoinedWith[S, D Any](d D, s ...S) S

JoinedWith returns the concatenation of parts' elements, with each element separated by the string calling this method. This method is the opposite of Splits.

func Last

func Last[S Any](length int, s S) S

Last returns the last length characters from the end of the string. If length is negative, returns the first length characters from the string's beginning.

func Length

func Length[S Any](s S) int

Length returns the number of characters in the string.

func MD5

func MD5[S Any](s S) []byte

MD5 returns the MD5 hash of the string as a byte slice.

func Map

func Map[S Any](mapping func(Rune) Rune, s S) S

Map returns a copy of the string s with all its characters modified according to the mapping function. If mapping returns a negative value, the character is dropped from the string with no replacement.

func Match

func Match[S Any](pattern, text S) bool

Match does a simple case-insensitive expression match, where * matches zero or more arbitrary characters and ? matches any single character except a period (.). An empty string or empty expression always evaluates to false.Does a simple case-insensitive expression match, where * matches zero or more arbitrary characters and ? matches any single character except a period (.). An empty string or empty expression always evaluates to false.

func MatchStrict

func MatchStrict[S Any](pattern, text S) bool

MatchStrict does a simple expression match (also called "glob" or "globbing"), where * matches zero or more arbitrary characters and ? matches any single character except a period (.). An empty string or empty expression always evaluates to false.

func Natural

func Natural[I ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uint | ~uintptr](number I) string

Natural converts the given unsigned int to a string representation, with the given base.

func NumExtractions

func NumExtractions[S Any, D Any](s S, delimiter D) int

NumExtractions returns the total number of extractable substrings when the string is split with the given delimiter (see Splits).

func PadDecimals

func PadDecimals[S Any](s S, digits int) S

PadDecimals formats the string representing a number to have an exact number of digits after the decimal point.

func PadPrefix

func PadPrefix[S Any](s S, min_length int) S

PadPrefix formats the string to be at least min_length long by adding characters to the left of the string, if necessary. See also PadSuffix.

func PadSuffix

func PadSuffix[S Any](s S, min_length int) S

PadSuffix formats the string to be at least min_length long, by adding characters to the right of the string, if necessary. See also PadPrefix.

func PadZeros

func PadZeros[S Any](s S, digits int) S

PadZeros formats the string representing a number to have an exact number of digits before the decimal point.

func Proxy

func Proxy[S Any, T API](s S, reuse func(T, complex128) bool, alloc func() (T, complex128)) (T, complex128)

Proxy can be used to transform the underlying encoding and implementation of a Readable string into a specific type. The alloc function should return a new [Implementation] of the desired type, and the internal state. This may be cached in the existing implementation and, if so, will be passed to the check function so that it can decide whether to reuse the cache or not.

The uint64 can be used to avoid unnecessary allocations, such that T can be zero-sized if the implementation does not require more that 64bits of state.

func Repeat

func Repeat[S Any](s S, count int) S

Repeat repeats this string a number of times. count needs to be greater than 0. Otherwise, returns an empty string.

func Replace

func Replace[S Any, T Any](s S, old, new T) S

Replace replaces all case-insensitive occurrences of what inside the string with the given forwhat.

func ReplaceStrict

func ReplaceStrict[S Any](s S, what, forwhat S) S

ReplaceStrict replaces all occurrences of what inside the string with the given forwhat.

func Reverse

func Reverse[S Any](s S) S

Reverse returns the copy of this string in reverse order. This operation works on unicode codepoints, rather than sequences of codepoints, and may break things like compound letters or emojis.

func ReverseSplit

func ReverseSplit[S Any](s S, delimiter S) []S

ReverseSplit splits the string using a delimiter and returns an array of the substrings, starting from the end of the string. The splits in the returned array appear in the same order as the original string.

func Runes

func Runes[S Any](s S) iter.Seq2[int, Rune]

Runes returns a sequence of runes in this string and their indices.

func SHA1

func SHA1[S Any](s S) S

SHA1 returns the SHA-1 hash of the string.

func SHA256

func SHA256[S Any](s S) S

SHA256 returns the SHA-256 hash of the string.

func Scientific

func Scientific[F Float.Any](number F) string

Scientific converts the given number to a string representation, in scientific notation.

func Similarity

func Similarity[S Any](a, b S) Float.X

Similarity returns the similarity index (Sorensen-Dice coefficient) of this string compared to another. A result of 1.0 means totally similar, while 0.0 means totally dissimilar.

func SimplifyPath

func SimplifyPath[S Any](s S) S

SimplifyPath converts the string into a canonical path if the string is a valid file path. This is the shortest possible path, without "./", and all the unnecessary ".." and "/".

func Slice

func Slice[S Any, A, B Int.Any](s S, start A, close B) S

Slice returns a slice of the string from the start index to the end index.

func Splits

func Splits[S Any, B Any](s S, sep B) iter.Seq[S]

Splits returns a sequence of substrings by splitting the string using a delimiter. If the delimiter is an empty string, each substring will be a single character. This method is the opposite of JoinedWith.

func StartingFrom

func StartingFrom[S Any](s S, start int) S

StartingFrom returns a slice of the string from the given start index to the end index.

func StripEscapes

func StripEscapes[S Any](s S) S

StripEscapes strips all escape characters from the string. These include all non-printable control characters of the first page of the ASCII table (values from 0 to 31), such as tabulation (\t) and newline (\n, \r) characters, but not spaces.

func StripFilename

func StripFilename[S Any](s S) S

StripFilename returns a copy of the string with all characters that are not allowed in IsValidFilename replaced with underscores.

func StripNodeName

func StripNodeName[S Any](s S) S

StripNodeName returns a copy of the string with all characters that are not allowed in Node.name (. : @ / " %) replaced with underscores.

func StripPrefix

func StripPrefix[S Any, C ~string | ~[]byte](s S, chars C) S

StripPrefix removes a set of characters defined in chars from the string's beginning. See also StripSuffix.

Note: chars is a cutset. Use TrimPrefix to remove a whole prefix string, rather than a set of characters.

func StripSuffix

func StripSuffix[S Any](s S, chars S) S

StripSuffix removes a set of characters defined in chars from the string's end. See also StripPrefix.

Note: chars is a cutset. Use TrimSuffix to remove an entire suffix, rather than a set of characters.

func Title

func Title[S Any](s S) S

Title returns a copy of the string s with all Unicode letters that begin words mapped to their Unicode title case. Is not always reliable in the presence of punctuation.

func ToASCII

func ToASCII[S Any](s S) []byte

ToASCII converts the string to an ASCII/Latin-1 encoded byte slice. This method is slightly faster than ToUTF8, but replaces all unsupported characters with spaces.

func ToCamelCase

func ToCamelCase[S Any](s S) S

ToCamelCase returns the string converted to camelCase.

func ToFloat

func ToFloat[S Any](s S) Float.X

ToFloat converts the string representing a decimal number into a float. This method stops on the first non-number character, except the first decimal point (.) and the exponent letter (e). See also IsValidFloat.

func ToInt

func ToInt[S Any](s S) int

ToInt converts the string representing an integer number into an int. This method removes any non-number character and stops at the first decimal point (.). See also IsValidInt.

func ToLower

func ToLower[S Any](s S) S

ToLower converts the string to lowercase.

func ToPascalCase

func ToPascalCase[S Any](s S) S

ToPascalCase returns the string converted to PascalCase.

func ToSnakeCase

func ToSnakeCase[S Any](s S) S

ToSnakeCase Returns the string converted to snake_case.

Note: Numbers followed by a single letter are not separated in the conversion to keep some words (such as "2D") together.

func ToUTF16

func ToUTF16[S Any](s S) []byte

ToUTF16 converts the string to a UTF-16.

func ToUTF32

func ToUTF32[S Any](s S) []byte

ToUTF32 converts the string to a UTF-32.

func ToUTF8

func ToUTF8[S Any](s S) []byte

ToUTF8 converts the string to a UTF-8 encoded byte slice. This method is slightly slower than ToASCII, but supports all UTF-8 characters. For most cases, prefer using this method.

func ToUpper

func ToUpper[S Any](s S) S

ToUpper returns the string converted to UPPERCASE.

func TrimPrefix

func TrimPrefix[S, P Any](s S, prefix P) S

TrimPrefix removes the given prefix from the start of the string, or returns the string unchanged.

func TrimSuffix

func TrimSuffix[S, P Any](s S, suffix P) S

TrimSuffix removes the given suffix from the end of the string, or returns the string unchanged.

func UTF16

func UTF16[S Any](s []byte) string

UTF16 converts UTF-16 encoded array to String. If the BOM is missing, system endianness is assumed. Returns empty string if source array is not valid UTF-16 string. This is the inverse of ToUTF16.

func UTF32

func UTF32[S Any](s S) string

UTF32 converts UTF-32 encoded array to string. If the BOM is missing, system endianness is assumed. Returns empty string if source array is not valid UTF-32 string. This is the inverse of ToUTF32.

func UTF8

func UTF8[S Any](s []byte) string

UTF8 converts UTF-8 encoded array to string. Slower than ASCII but supports UTF-8 encoded data. Use this function if you are unsure about the source of the data. For user input this function should always be preferred. Returns empty string if source array is not valid UTF-8 string. This is the inverse of ToUTF8.

func Unescape

func Unescape[S Any](s S) S

Unescape returns a copy of the string with escaped characters replaced by their meanings.

Types

type API

type API interface {
	Len(complex128) int
	Slice(complex128, int, int) Readable
	String(complex128) string
	Index(complex128, int) byte
	DecodeRune(complex128) (Rune, int, Readable)
	AppendRune(complex128, Rune) Readable
	AppendOther(complex128, API, complex128) Readable
	AppendString(complex128, string) Readable
}

API required to implement a Readable string.

type Any

type Any interface {
	~string | ~[]byte | ~Generic | ~Comparable | unique.Handle[string] | Rune | []rune
}

type Comparable

type Comparable = struct {
	// contains filtered or unexported fields
}

Comparable string optimized for use as a key, such that comparisons are efficient.

func MakeComparable

func MakeComparable[T Any](s T) Comparable

type Generic

type Generic = struct {
	// contains filtered or unexported fields
}

Generic can be used as a ~T parameter that accept any Readable-like type.

type Name

type Name Generic

Name will be replaced with Comparable in Go 1.24

func (Name) String

func (name Name) String() string

String implements the fmt.Stringer interface.

type Readable

type Readable Generic

Readable string containing human-readable characters in an implementation-specific encoding.

func New

func New(val ...any) Readable

New returns a new Readable string concatenated from the given values.

func Via

func Via(impl API, state complex128) Readable

func (Readable) MarshalText

func (utf Readable) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (Readable) Size

func (utf Readable) Size() int

Size returns the number of bytes of data stored in the Readable.

func (Readable) String

func (utf Readable) String() string

String returns a copy of the Readable as a raw string.

func (*Readable) UnmarshalText

func (utf *Readable) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

type Rune

type Rune rune

func UnicodeAt

func UnicodeAt[S Any](s S, index int) Rune

UnicodeAt returns the Unicode code point at the given index in the string.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL