---
title: "String"
description: "Static string related functions."
canonical_url: "https://www.zeyos.com/zymba/ref/string"
markdown_url: "https://www.zeyos.com/ai/guide/zymba/ref/string.md"
section: "zymba-reference"
authority: "reference"
language: "en"
source_repository: "https://cloud.zeyos.com/__doc/zymbaref.json"
source_sha256: "05a361c6ddc32e74f4a6dc16fd06f218210ff1b7ce57f26ca1994bfffc407915"
---

# String

## String

```
object @String() {
	byteAt(string $string, int $offset): string {}
	byteCodeAt(string $string, int $offset): int {}
	byteIndexOf(string $string, string $substring): int {}
	capitalize(string $string): string {}
	capitalizeWords(string $string): string {}
	charAt(string $string, int $offset): string {}
	charCodeAt(string $string, int $offset): int {}
	chop(string $string, int $length, string $delimiter): string {}
	chopOnBytes(string $string, int $length, string $delimiter): string {}
	compare(string $string1, string $string2): int {}
	compareNatural(string $string1, string $string2): int {}
	concat(...$strings): string {}
	contains(string $string, string $substring): bool {}
	containsInsensitive(string $string, string $substring): bool {}
	convert(string $string, string $from, string $to): string {}
	countBytes(string $string): int {}
	countChars(string $string): int {}
	countDistinctBytes(string $string): int {}
	countDistinctChars(string $string): int {}
	countSubstring(string $string, string $substring): int {}
	countUsedBytes(string $string): object {}
	countUsedChars(string $string): object {}
	crc32(string $string): int {}
	distanceBetween(string $string1, string $string2): int {}
	endsWith(string $string, string $substring): bool {}
	endsWithInsensitive(string $string, string $substring): bool {}
	equals(string $string1, string $string2): bool {}
	equalsInsensitive(string $string1, string $string2): bool {}
	escapeC(string $string): string {}
	foldCase(string $string): string {}
	format(string $string, ...$arguments): string {}
	fromByteCodes(object $codes): string {}
	fromCharCodes(object $codes): string {}
	fromHex(string $string): string {}
	fromLatin1(string $string): string {}
	hasByteIndex(string $string, int $index): bool {}
	hasIndex(string $string, int $index): bool {}
	head(string $string): string {}
	headOnBytes(string $string): string {}
	indexOf(string $string, string $substring): int {}
	indexOfInsensitive(string $string, string $substring): int {}
	insert(string $string, string $substring, int $offset): string {}
	insertOnBytes(string $string, string $substring, int $offset): string {}
	isBinaryDigits(string $string): bool {}
	isDecimalDigits(string $string): bool {}
	isEmpty(string $string): bool {}
	isHexDigits(string $string): bool {}
	isMarkedUTF8(string $string): bool {}
	isOctalDigits(string $string): bool {}
	isPrintable(string $string): bool {}
	isSingleByte(string $string): bool {}
	isSingleChar(string $string): bool {}
	isValidASCII(string $string): bool {}
	isValidUTF8(string $string): bool {}
	isWhiteSpace(string $string): bool {}
	lastByteIndexOf(string $string, string $substring): int {}
	lastIndexOf(string $string, string $substring): int {}
	lastIndexOfInsensitive(string $string, string $substring): int {}
	metaphone(string $string): string {}
	normalizeLineBreaks(string $string): string {}
	normalizeWhiteSpace(string $string): string {}
	pad(string $string, int $length, string $padding): string {}
	padOnBytes(string $string, int $length, string $padding): string {}
	partition(string $string, int $length): object {}
	partitionOnBytes(string $string, int $length): object {}
	quote(string $string, string $delimiter): string {}
	repeat(string $string, int $count): string {}
	replace(string $string, string $substring, string $replacement, int $limit): string {}
	replaceMultiple(string $string, object $replacements): string {}
	reverse(string $string): string {}
	reverseOnBytes(string $string): string {}
	scrub(string $string): string {}
	slice(string $string, int $offset, ?int $length): string {}
	sliceOnBytes(string $string, int $offset, ?int $length): string {}
	soundex(string $string): string {}
	splice(string $string, int $offset, ?int $length, string $replacement): string {}
	spliceOnBytes(string $string, int $offset, ?int $length, string $replacement): string {}
	split(string $string, string $delimiter, int $limit): object {}
	splitNonEmpty(string $string, string $delimiter, int $limit): object {}
	startsWith(string $string, string $substring): bool {}
	startsWithInsensitive(string $string, string $substring): bool {}
	tail(string $string): string {}
	tailOnBytes(string $string): string {}
	toByteCodes(string $string): object {}
	toCharCodes(string $string): object {}
	toHex(string $string): string {}
	toLatin1(string $string): string {}
	toLower(string $string): string {}
	toLowerASCII(string $string): string {}
	toUpper(string $string): string {}
	toUpperASCII(string $string): string {}
	trim(string $string): string {}
	trimLeft(string $string): string {}
	trimRight(string $string): string {}
	truncate(string $string, int $offset, int $length, string $marker): string {}
	unescapeC(string $string): string {}
}
```

**Static string related functions.**

## Functions


### `@String.byteAt()`


Returns the byte at a specific byte-based offset within a string.

```code
@String.byteAt(string $string, int $offset): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |
| offset | `int`  |  | 0 |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |
| `null` |  |




### `@String.byteCodeAt()`


Returns the US-ASCII code of the byte at a specific byte-based offset within a string.

```code
@String.byteCodeAt(string $string, int $offset): int
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |
| offset | `int`  |  | 0 |

##### Returns

| Type | Value |
| --- | ---  |
| `int` |  |
| `null` |  |




### `@String.byteIndexOf()`


Returns the byte-based index of the first occurrence of a specific substring within a string.

```code
@String.byteIndexOf(string $string, string $substring): int
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |
| substring | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `int` |  |
| `null` |  |




### `@String.capitalize()`


Capitalizes the first character within a string.

```code
@String.capitalize(string $string): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@String.capitalizeWords()`


Capitalizes every word within a string.

```code
@String.capitalizeWords(string $string): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@String.charAt()`


Returns the character at a specific character-based offset within a string.

```code
@String.charAt(string $string, int $offset): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |
| offset | `int`  |  | 0 |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |
| `null` |  |




### `@String.charCodeAt()`


Returns the UTF-8 code of the character at a specific character-based offset within a string.

```code
@String.charCodeAt(string $string, int $offset): int
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |
| offset | `int`  |  | 0 |

##### Returns

| Type | Value |
| --- | ---  |
| `int` |  |
| `null` |  |




### `@String.chop()`


Chops a string into substrings of a specific character-based length, rejoined with a specific delimiter.

```code
@String.chop(string $string, int $length, string $delimiter): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |
| length | `int`  |  | 76 |
| delimiter | `string`  |  | "\r\n" |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@String.chopOnBytes()`


Chops a string into substrings of a specific byte-based length, rejoined with a specific delimiter.

```code
@String.chopOnBytes(string $string, int $length, string $delimiter): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |
| length | `int`  |  | 76 |
| delimiter | `string`  |  | "\r\n" |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@String.compare()`


Compares two strings in a lexicographic manner.

```code
@String.compare(string $string1, string $string2): int
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string1 | `string`  |  | "" |
| string2 | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `int` | +1 |
| `int` | -1 |
| `int` | 0 |




### `@String.compareNatural()`


Compares two strings in a natural and case-insensitive manner (US-ASCII only).

```code
@String.compareNatural(string $string1, string $string2): int
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string1 | `string`  |  | "" |
| string2 | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `int` | +1 |
| `int` | -1 |
| `int` | 0 |




### `@String.concat()`


Concatenates specific strings and returns the combined end-to-end string.

```code
@String.concat(variadic $strings): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| strings | `variadic`  |  | ... |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@String.contains()`


Determines whether a string contains a specific substring.

```code
@String.contains(string $string, string $substring): bool
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |
| substring | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `bool` |  |




### `@String.containsInsensitive()`


Determines whether a string contains a specific substring in a case-insensitive manner (UTF-8).

```code
@String.containsInsensitive(string $string, string $substring): bool
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |
| substring | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `bool` |  |




### `@String.convert()`


Converts the character encoding of a string from one character set into another.

```code
@String.convert(string $string, string $from, string $to): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |
| from | `string`  |  | "UTF-8" |
| to | `string`  |  | "UTF-8" |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@String.countBytes()`


Counts the total number of bytes within a string.

```code
@String.countBytes(string $string): int
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `int` |  |




### `@String.countChars()`


Counts the total number of characters within a string.

```code
@String.countChars(string $string): int
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `int` |  |




### `@String.countDistinctBytes()`


Counts the total number of distinct bytes within a string.

```code
@String.countDistinctBytes(string $string): int
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `int` |  |




### `@String.countDistinctChars()`


Counts the total number of distinct characters within a string.

```code
@String.countDistinctChars(string $string): int
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `int` |  |




### `@String.countSubstring()`


Counts the total number of occurrences of a specific substring within a string.

```code
@String.countSubstring(string $string, string $substring): int
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |
| substring | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `int` |  |




### `@String.countUsedBytes()`


Counts the total number of occurrences for each byte within a string.

```code
@String.countUsedBytes(string $string): object
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `object` | [unique-byte: count, ...] |




### `@String.countUsedChars()`


Counts the total number of occurrences for each character within a string.

```code
@String.countUsedChars(string $string): object
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `object` | [unique-character: count, ...] |




### `@String.crc32()`


Generates the 32-bit cyclic redundancy checksum polynomial of a string as a signed integer.

```code
@String.crc32(string $string): int
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `int` |  |




### `@String.distanceBetween()`


Measures the Levenshtein distance between two strings.

```code
@String.distanceBetween(string $string1, string $string2): int
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string1 | `string`  |  | "" |
| string2 | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `int` |  |




### `@String.endsWith()`


Determines whether a string ends with a specific substring.

```code
@String.endsWith(string $string, string $substring): bool
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |
| substring | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `bool` |  |




### `@String.endsWithInsensitive()`


Determines whether a string ends with a specific substring in a case-insensitive manner (UTF-8).

```code
@String.endsWithInsensitive(string $string, string $substring): bool
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |
| substring | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `bool` |  |




### `@String.equals()`


Determines whether two strings are equal.

```code
@String.equals(string $string1, string $string2): bool
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string1 | `string`  |  | "" |
| string2 | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `bool` |  |




### `@String.equalsInsensitive()`


Determines whether two strings are equal in a case-insensitive manner (UTF-8).

```code
@String.equalsInsensitive(string $string1, string $string2): bool
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string1 | `string`  |  | "" |
| string2 | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `bool` |  |




### `@String.escapeC()`


Escapes all non-printable (plus backslash "\") US-ASCII characters within a string using C-style (octal) escape sequences.

```code
@String.escapeC(string $string): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@String.foldCase()`


Converts a string according to length-preserving case-folding rules (UTF-8).

```code
@String.foldCase(string $string): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@String.format()`


Returns a formatted string with "printf"-compatible format specifiers ("%...") substituted with variadic arguments.

```code
@String.format(string $string, variadic $arguments): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |
| arguments | `variadic`  |  | ... |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@String.fromByteCodes()`


Returns the string corresponding to an US-ASCII code sequence.

```code
@String.fromByteCodes(object $codes): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| codes | `object`  | [code, ...] | [] |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@String.fromCharCodes()`


Returns the string corresponding to an UTF-8 code sequence.

```code
@String.fromCharCodes(object $codes): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| codes | `object`  | [code, ...] | [] |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@String.fromHex()`


```code
@String.fromHex(string $string): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@String.fromLatin1()`


Converts the character encoding of a string from single-byte ISO-8859-1 into multi-byte UTF-8.

```code
@String.fromLatin1(string $string): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@String.hasByteIndex()`


Determines whether a string has a specific byte-based index.

```code
@String.hasByteIndex(string $string, int $index): bool
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |
| index | `int`  |  | 0 |

##### Returns

| Type | Value |
| --- | ---  |
| `bool` |  |




### `@String.hasIndex()`


Determines whether a string has a specific character-based index.

```code
@String.hasIndex(string $string, int $index): bool
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |
| index | `int`  |  | 0 |

##### Returns

| Type | Value |
| --- | ---  |
| `bool` |  |




### `@String.head()`


Returns the character-based head of a string, meaning only the first character.

```code
@String.head(string $string): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@String.headOnBytes()`


Returns the byte-based head of a string, meaning only the first byte.

```code
@String.headOnBytes(string $string): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@String.indexOf()`


Returns the character-based index of the first occurrence of a specific substring within a string.

```code
@String.indexOf(string $string, string $substring): int
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |
| substring | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `int` |  |
| `null` |  |




### `@String.indexOfInsensitive()`


Returns the character-based index of the first occurrence of a specific substring within a string, searching in a case-insensitive manner (UTF-8).

```code
@String.indexOfInsensitive(string $string, string $substring): int
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |
| substring | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `int` |  |
| `null` |  |




### `@String.insert()`


Inserts a specific substring into a string at a specific character-based offset.

```code
@String.insert(string $string, string $substring, int $offset): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |
| substring | `string`  |  | "" |
| offset | `int`  |  | 0 |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@String.insertOnBytes()`


Inserts a specific substring into a string at a specific byte-based offset.

```code
@String.insertOnBytes(string $string, string $substring, int $offset): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |
| substring | `string`  |  | "" |
| offset | `int`  |  | 0 |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@String.isBinaryDigits()`


Determines whether a string consists only of characters representing binary digits.

```code
@String.isBinaryDigits(string $string): bool
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `bool` |  |




### `@String.isDecimalDigits()`


Determines whether a string consists only of characters representing decimal digits.

```code
@String.isDecimalDigits(string $string): bool
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `bool` |  |




### `@String.isEmpty()`


Determines whether a string is empty, meaning it does not contain any bytes or characters.

```code
@String.isEmpty(string $string): bool
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `bool` |  |




### `@String.isHexDigits()`


Determines whether a string consists only of characters representing hexadecimal digits.

```code
@String.isHexDigits(string $string): bool
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `bool` |  |




### `@String.isMarkedUTF8()`


Determines whether a string has an UTF-8 byte order mark (BOM).

```code
@String.isMarkedUTF8(string $string): bool
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `bool` |  |




### `@String.isOctalDigits()`


Determines whether a string consists only of characters representing octal digits.

```code
@String.isOctalDigits(string $string): bool
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `bool` |  |




### `@String.isPrintable()`


Determines whether a string represents a valid sequence of printable US-ASCII characters.

```code
@String.isPrintable(string $string): bool
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `bool` |  |




### `@String.isSingleByte()`


Determines whether a string consists only of a single byte.

```code
@String.isSingleByte(string $string): bool
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `bool` |  |




### `@String.isSingleChar()`


Determines whether a string consists only of a single character.

```code
@String.isSingleChar(string $string): bool
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `bool` |  |




### `@String.isValidASCII()`


Determines whether a string represents a valid sequence of US-ASCII characters.

```code
@String.isValidASCII(string $string): bool
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `bool` |  |




### `@String.isValidUTF8()`


Determines whether a string represents a valid sequence of UTF-8 characters.

```code
@String.isValidUTF8(string $string): bool
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `bool` |  |




### `@String.isWhiteSpace()`


Determines whether a string consists only of US-ASCII white space characters.

```code
@String.isWhiteSpace(string $string): bool
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `bool` |  |




### `@String.lastByteIndexOf()`


Returns the byte-based index of the last occurrence of a specific substring within a string.

```code
@String.lastByteIndexOf(string $string, string $substring): int
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |
| substring | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `int` |  |
| `null` |  |




### `@String.lastIndexOf()`


Returns the character-based index of the last occurrence of a specific substring within a string.

```code
@String.lastIndexOf(string $string, string $substring): int
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |
| substring | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `int` |  |
| `null` |  |




### `@String.lastIndexOfInsensitive()`


Returns the character-based index of the last occurrence of a specific substring within a string, searching in a case-insensitive manner (UTF-8).

```code
@String.lastIndexOfInsensitive(string $string, string $substring): int
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |
| substring | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `int` |  |
| `null` |  |




### `@String.metaphone()`


Generates the metaphone key of a string.

```code
@String.metaphone(string $string): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@String.normalizeLineBreaks()`


Normalizes line breaks by replacing all end-of-line markers (carriage return and/or line feed) with single line feeds.

```code
@String.normalizeLineBreaks(string $string): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@String.normalizeWhiteSpace()`


Normalizes white space by replacing all consecutive sequences of US-ASCII white space characters with single blank spaces.

```code
@String.normalizeWhiteSpace(string $string): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@String.pad()`


Pads a string to a specific character-based length by repeatedly filling it with a specific padding string.

```code
@String.pad(string $string, int $length, string $padding): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |
| length | `int`  |  | 0 |
| padding | `string`  |  | " " |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@String.padOnBytes()`


Pads a string to a specific byte-based length by repeatedly filling it with a specific padding string.

```code
@String.padOnBytes(string $string, int $length, string $padding): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |
| length | `int`  |  | 0 |
| padding | `string`  |  | " " |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@String.partition()`


Partitions a string into isolated substrings of a specific character-based length.

```code
@String.partition(string $string, int $length): object
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |
| length | `int`  |  | 1 |

##### Returns

| Type | Value |
| --- | ---  |
| `object` | [substring, ...] |




### `@String.partitionOnBytes()`


Partitions a string into isolated substrings of a specific byte-based length.

```code
@String.partitionOnBytes(string $string, int $length): object
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |
| length | `int`  |  | 1 |

##### Returns

| Type | Value |
| --- | ---  |
| `object` | [substring, ...] |




### `@String.quote()`


Quotes a string by wrapping it with a specific delimiter.

```code
@String.quote(string $string, string $delimiter): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |
| delimiter | `string`  |  | "'" |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@String.repeat()`


Repeatedly concatenates a specific string to itself and returns the aligned end-to-end string.

```code
@String.repeat(string $string, int $count): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |
| count | `int`  |  | 1 |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@String.replace()`


Replaces all occurrences of a specific substring within a string with a specific replacement.

```code
@String.replace(string $string, string $substring, string $replacement, int $limit): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |
| substring | `string`  |  | "" |
| replacement | `string`  |  | "" |
| limit | `int`  |  | 0 |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@String.replaceMultiple()`


```code
@String.replaceMultiple(string $string, object $replacements): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |
| replacements | `object`  | [substring: replacement, ...] | [] |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@String.reverse()`


Reverses the sequence of characters within a string.

```code
@String.reverse(string $string): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@String.reverseOnBytes()`


Reverses the sequence of bytes within a string.

```code
@String.reverseOnBytes(string $string): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@String.scrub()`


Scrub ill-formed UTF-8 characters from a string by replacing those with placeholder question marks ("?").

```code
@String.scrub(string $string): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@String.slice()`


Slices a string by retrieving a specific character-based portion.

```code
@String.slice(string $string, int $offset, ?int $length): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |
| offset | `int`  |  | 0 |
| length | `?int`  |  | maximum length |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@String.sliceOnBytes()`


Slices a string by retrieving a specific byte-based portion.

```code
@String.sliceOnBytes(string $string, int $offset, ?int $length): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |
| offset | `int`  |  | 0 |
| length | `?int`  |  | maximum length |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@String.soundex()`


Generates the 4-character soundex key of a string.

```code
@String.soundex(string $string): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@String.splice()`


Extracts a specific character-based portion of a string and replaces it with a specific replacement string.

```code
@String.splice(string $string, int $offset, ?int $length, string $replacement): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |
| offset | `int`  |  | 0 |
| length | `?int`  |  | maximum length |
| replacement | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@String.spliceOnBytes()`


Extracts a specific byte-based portion of a string and replaces it with a specific replacement string.

```code
@String.spliceOnBytes(string $string, int $offset, ?int $length, string $replacement): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |
| offset | `int`  |  | 0 |
| length | `?int`  |  | maximum length |
| replacement | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@String.split()`


Splits a string into isolated substrings on boundaries formed by a specific delimiter, whereas empty substrings are retained.

```code
@String.split(string $string, string $delimiter, int $limit): object
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |
| delimiter | `string`  |  | " " |
| limit | `int`  |  | 0 |

##### Returns

| Type | Value |
| --- | ---  |
| `object` | [substring, ...] |




### `@String.splitNonEmpty()`


Splits a string into isolated substrings on boundaries formed by a specific delimiter, whereas empty substrings are discarded.

```code
@String.splitNonEmpty(string $string, string $delimiter, int $limit): object
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |
| delimiter | `string`  |  | " " |
| limit | `int`  |  | 0 |

##### Returns

| Type | Value |
| --- | ---  |
| `object` | [substring, ...] |




### `@String.startsWith()`


Determines whether a string starts with a specific substring.

```code
@String.startsWith(string $string, string $substring): bool
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |
| substring | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `bool` |  |




### `@String.startsWithInsensitive()`


Determines whether a string starts with a specific substring in a case-insensitive manner (UTF-8).

```code
@String.startsWithInsensitive(string $string, string $substring): bool
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |
| substring | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `bool` |  |




### `@String.tail()`


Returns the character-based tail of a string, meaning all characters except the first.

```code
@String.tail(string $string): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@String.tailOnBytes()`


Returns the byte-based tail of a string, meaning all bytes except the first.

```code
@String.tailOnBytes(string $string): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@String.toByteCodes()`


Returns the US-ASCII code sequence of all bytes within a string.

```code
@String.toByteCodes(string $string): object
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `object` | [code, ...] |




### `@String.toCharCodes()`


Returns the UTF-8 code sequence of all characters within a string.

```code
@String.toCharCodes(string $string): object
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `object` | [code, ...] |




### `@String.toHex()`


```code
@String.toHex(string $string): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@String.toLatin1()`


Converts the character encoding of a string from multi-byte UTF-8 to single-byte ISO-8859-1.

```code
@String.toLatin1(string $string): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@String.toLower()`


Converts a string to lower case (UTF-8).

```code
@String.toLower(string $string): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@String.toLowerASCII()`


Converts a string to lower case (US-ASCII only).

```code
@String.toLowerASCII(string $string): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@String.toUpper()`


Converts a string to upper case (UTF-8).

```code
@String.toUpper(string $string): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@String.toUpperASCII()`


Converts a string to upper case (US-ASCII only).

```code
@String.toUpperASCII(string $string): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@String.trim()`


Trims a string by stripping all US-ASCII white space characters from its beginning and end.

```code
@String.trim(string $string): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@String.trimLeft()`


Trims a string left-sidedly by stripping all US-ASCII white space characters from its beginning.

```code
@String.trimLeft(string $string): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@String.trimRight()`


Trims a string right-sidedly by stripping all US-ASCII white space characters from its end.

```code
@String.trimRight(string $string): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@String.truncate()`


Truncates a string to a specific byte-based length, where half-width characters count as 1, and full-width characters count as 2.

```code
@String.truncate(string $string, int $offset, int $length, string $marker): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |
| offset | `int`  |  | 0 |
| length | `int`  |  | 255 |
| marker | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@String.unescapeC()`


Resolve all C-style escape sequences in a string.

```code
@String.unescapeC(string $string): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |
