Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

VRage.Game.ModAPI.Ingame.Utilities.TextPtr

Morten Aune Lyrstad edited this page Apr 16, 2022 · 43 revisions

IndexNamespace Index

TextPtr Struct

public struct TextPtr

A parser utility structure representing a pointer to a location within a string.

Namespace: VRage.Game.ModAPI.Ingame.Utilities
Assembly: VRage.Game.dll

Fields

string Content

The original content string

int Index

The index being pointed at by this structure

Properties

char Char { get; }

Returns the character currently being pointed at, or\0if out of bounds

bool IsEmpty { get; }

Determines whether this pointer is an empty pointer, i.e. not pointing at anything at all.

Constructors

TextPtr(string content)

TextPtr(string content, int index)

Methods

TextPtr Find(string str)

Finds the given text string

TextPtr Find(char ch)

Finds the given character

TextPtr FindAny(Char&#91] chs)

Finds one of the given characters

TextPtr FindAnyInLine(Char&#91] chs)

Finds one of the given characters within the current line

TextPtr FindEndOfLine(bool skipNewline = default)

Finds the end of the current line

TextPtr FindInLine(char ch)

Finds the given character within the current line

int FindLineNo()

Determines what line number this pointer is currently at.

bool IsEndOfLine()

Determines whether the pointer is currently at the end of a line (right before a newline character set or end of the string)

bool IsNewLine()

Determines whether the pointer is currently at a newline (end of the string is not a newline)

bool IsOutOfBounds()

Determines whether this pointer is currently out of bounds (before or after the string content)

bool IsStartOfLine()

Determines whether the pointer is currently at the beginning of a line (right after a newline character set or start of the string)

TextPtr SkipWhitespace(bool skipNewline = default)

Skips whitespace

bool StartsWith(string what)

Determines if the current pointer location starts with the given string - in a case sensitive manner.

bool StartsWithCaseInsensitive(string what)

Determines if the current pointer location starts with the given string - in a case insensitive manner.

TextPtr TrimEnd()

Reverses the pointer location until all whitespace is skipped - does not skip newlines

TextPtr TrimStart()

Advances the pointer location until all whitespace is skipped - does not skip newlines

Clone this wiki locally