Table of Contents

Class StringExtensions

Namespace
Anvil.API
Assembly
NWN.Anvil.dll

String helpers for script names, object ID parsing, color tokens, and common conversions.

public static class StringExtensions
Inheritance
StringExtensions
Inherited Members

Methods

AppendColored(StringBuilder, string, Color)

Appends the specified text wrapped in a NWN color token.

ColorString(string, Color)

Wraps the specified text in a NWN color token string.

IsReservedScriptName(string)

Gets whether the specified script name is reserved by Anvil.

IsValidScriptName(string?, bool)

Validates a script name against engine constraints.

ParseFloat(string)

Parses the specified string as a float.

ParseFloat(string, float)

Parses the specified string as a float.

ParseInt(string)

Parses the specified string as an integer.

ParseInt(string, int)

Parses the specified string as an integer.

ParseIntBool(string)

Parses the specified string as an integer based boolean (1 = true, 0 = false).

ParseIntBool(string, bool)

Parses the specified string as an integer based boolean (1 = true, 0 = false).

ParseObject(string)

Resolves the specified GameObject ID string to an object.
This is the temporary ID created from ToString(). See ToNwObject(Guid) to parse persistent UUIDs.

ParseObject<T>(string)

Resolves the specified GameObject ID string to an object.
This is the temporary ID created from ToString(). See ToNwObject(Guid) to parse persistent UUIDs.

ReadBlock(StringReader, int)

Reads up to the specified number of characters from the reader.

ReadUntilChar(StringReader, char)

Reads characters until the specified character is encountered, without consuming it.

Skip(StringReader, int)

Advances the reader by the specified number of characters.

StripColors(string)

Strip any color codes from a string.

ToBase64EncodedString(byte[])

Encodes the specified byte array as a base64 string.

ToByteArray(string)

Converts a base64 string to a byte array.

TryParseFloat(string, out float)

Tries to parse a float from the provided string.

TryParseInt(string, out int)

Tries to parse an integer from the provided string.

TryParseIntBool(string, out bool)

Tries to parse an integer-based boolean (1/0) and convert to a managed boolean using NWScript semantics.

TryParseObject(string, out NwObject?)

Tries to resolve the specified GameObject ID string to an object. A return value indicates whether the conversion succeeded or failed.
This is the temporary ID created from ToString(). See ToNwObject(Guid) to parse persistent UUIDs.

TryParseObject<T>(string, out T?)

Tries to resolve the specified GameObject ID string to an object. A return value indicates whether the conversion succeeded or failed.
This is the temporary ID created from ToString(). See ToNwObject(Guid) to parse persistent UUIDs.