# string

Library to interact with strings.

## Types

### `std::string::NullString`

A null-terminated ASCII string.

```rust
using NullString = std::string::NullStringBase;
```

### `std::string::NullString16`

A null-terminated UTF-16 string.

```rust
using NullString16 = std::string::NullStringBase;
```

### `std::string::NullStringBase`

Base type for null-terminated strings. Represents a string with its size determined by the first 0x00 byte found.

* `<DataType>`: The type of the characters.

```rust
struct NullStringBase<DataType> { ... } [[sealed, format, transform]];
```

### `std::string::SizedString`

A ASCII string with a prefixed size.

* `<SizeType>`: The type of the size field.

```rust
using SizedString<SizeType> = std::string::SizedStringBase;
```

### `std::string::SizedString16`

A UTF-16 string with a prefixed size.

* `<SizeType>`: The type of the size field.

```rust
using SizedString16<SizeType> = std::string::SizedStringBase;
```

### `std::string::SizedStringBase`

Base type for sized strings. Represents a string with its size preceding it.

* `<SizeType>`: The type of the size field.
* `<DataType>`: The type of the characters.

```rust
struct SizedStringBase<SizeType, DataType> { ... } [[sealed, format, transform]];
```

## Functions

### `std::string::length`

Gets the length of a string.

* `string`: The string to get the length of.
* `return`: The length of the string.

```rust
fn length( string);
```

### `std::string::at`

Gets the character at a given index.

* `string`: The string to get the character from.
* `index`: The index of the character to get.
* `return`: The character at the given index.

```rust
fn at( string,  index);
```

### `std::string::substr`

Gets a substring of a string.

* `string`: The string to get the substring from.
* `pos`: The position of the first character of the substring.
* `count`: The number of characters to get.
* `return`: The substring.

```rust
fn substr( string,  pos,  count);
```

### `std::string::parse_int`

Converts a string to an integer.

* `string`: The string to convert.
* `base`: The base of the number.
* `return`: The integer.

```rust
fn parse_int( string,  base);
```

### `std::string::parse_float`

Converts a string to a float.

* `string`: The string to convert.
* `return`: The float.

```rust
fn parse_float( string);
```

### `std::string::to_string`

Converts any type to a string.

* `x`: The value to convert.
* `return`: The string.

```rust
fn to_string( x);
```

### `std::string::starts_with`

Checks if a string starts with a given substring.

* `string`: The string to check.
* `part`: The substring to check for.
* `return`: True if the string starts with the substring, false otherwise.

```rust
fn starts_with( string,  part);
```

### `std::string::ends_with`

Checks if a string ends with a given substring.

* `string`: The string to check.
* `part`: The substring to check for.
* `return`: True if the string ends with the substring, false otherwise.

```rust
fn ends_with( string,  part);
```

### `std::string::contains`

Checks if a string contains a given substring.

* `string`: The string to check.
* `part`: The substring to check for.
* `return`: True if the string contains the substring, false otherwise.

```rust
fn contains( string,  part);
```

### `std::string::reverse`

Reverses a string.

* `string`: The string to reverse.
* `return`: The reversed string.

```rust
fn reverse( string);
```

### `std::string::to_upper`

Converts a string to upper case.

* `string`: The string to convert.
* `return`: The converted string.

```rust
fn to_upper( string);
```

### `std::string::to_lower`

Converts a string to lower case.

* `string`: The string to convert.
* `return`: The converted string.

```rust
fn to_lower( string);
```

### `std::string::replace`

Replaces all occurrences of a substring with another substring.

* `string`: The string to replace in.
* `pattern`: The substring to replace.
* `replace`: The substring to replace with.
* `return`: The string with the replacements.

```rust
fn replace( string,  pattern,  replace);
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.werwolv.net/pattern-language/libraries/std/string.pat.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
