Table of Contents

Class ParsingUtility

Namespace
TMPEffects.TextProcessing
Assembly
TMPEffects.dll

Utility methods for text processing and parsing.

public static class ParsingUtility
Inheritance
ParsingUtility
Inherited Members

Fields

ColorKeyWords

public static readonly ReadOnlyDictionary<string, Color> ColorKeyWords

Field Value

ReadOnlyDictionary<string, Color>

Methods

GetNextTag(string, int, ref TagInfo, TagType)

Get the next tag in text, starting from startIndex.

public static bool GetNextTag(string text, int startIndex, ref ParsingUtility.TagInfo tag, ParsingUtility.TagType type = TagType.Open | TagType.Close)

Parameters

text string

The full string.

startIndex int

The index to start the search from.

tag ParsingUtility.TagInfo

Reference to a ParsingUtility.TagInfo. Will be set to the parsed tag if one is found.

type ParsingUtility.TagType

The type of tag to get. Leave at default for either type.

Returns

bool

true if a next tag was found; false otherwise.

GetTagParametersDict(string)

public static Dictionary<string, string> GetTagParametersDict(string tag)

Parameters

tag string

Returns

Dictionary<string, string>

IsTag(string, int, int, TagType)

Checks if the given string contains a substring starting at startIndex, going up to maxIndex, that is a well formed tag.

public static bool IsTag(string text, int startIndex, int maxIndex = -1, ParsingUtility.TagType type = TagType.Open | TagType.Close)

Parameters

text string

The string to check.

startIndex int

The start index of the substring.

maxIndex int

The end index of the substring. Leave at default to set to length of text.

type ParsingUtility.TagType

Returns

bool

true if the given string contains a substring starting at startIndex, going up to maxIndex, that is a well formed tag; otherwise false.

IsTag(string, TagType)

Checks if the given string is a well formed tag (of the given type, if supplied).

public static bool IsTag(string tag, ParsingUtility.TagType type = TagType.Open | TagType.Close)

Parameters

tag string

The string to check.

type ParsingUtility.TagType

The type of tag to check for. Leave default for either type.

Returns

bool

true if the the given string is a tag (of the given type, if supplied); otherwise false.

StringToAnchor(string, out Vector2, IDictionary<string, Vector2>, IDictionary<string, Vector2>)

public static bool StringToAnchor(string str, out Vector2 result, IDictionary<string, Vector2> anchorKeywords = null, IDictionary<string, Vector2> vectorKeywords = null)

Parameters

str string
result Vector2
anchorKeywords IDictionary<string, Vector2>
vectorKeywords IDictionary<string, Vector2>

Returns

bool

StringToAnimationCurve(string, out AnimationCurve, IDictionary<string, AnimationCurve>)

public static bool StringToAnimationCurve(string str, out AnimationCurve result, IDictionary<string, AnimationCurve> keywords = null)

Parameters

str string
result AnimationCurve
keywords IDictionary<string, AnimationCurve>

Returns

bool

StringToBool(string, out bool, IDictionary<string, bool>)

public static bool StringToBool(string str, out bool result, IDictionary<string, bool> keywords = null)

Parameters

str string
result bool
keywords IDictionary<string, bool>

Returns

bool

StringToColor(string, out Color, IDictionary<string, Color>)

public static bool StringToColor(string str, out Color result, IDictionary<string, Color> keywords = null)

Parameters

str string
result Color
keywords IDictionary<string, Color>

Returns

bool

StringToFloat(string, out float, IDictionary<string, float>)

public static bool StringToFloat(string str, out float result, IDictionary<string, float> keywords = null)

Parameters

str string
result float
keywords IDictionary<string, float>

Returns

bool

StringToInt(string, out int, IDictionary<string, int>)

public static bool StringToInt(string str, out int result, IDictionary<string, int> keywords = null)

Parameters

str string
result int
keywords IDictionary<string, int>

Returns

bool

StringToVector2(string, out Vector2, IDictionary<string, Vector2>)

public static bool StringToVector2(string str, out Vector2 result, IDictionary<string, Vector2> keywords = null)

Parameters

str string
result Vector2
keywords IDictionary<string, Vector2>

Returns

bool

StringToVector2Offset(string, out Vector2, IDictionary<string, Vector2>)

public static bool StringToVector2Offset(string str, out Vector2 result, IDictionary<string, Vector2> keywords = null)

Parameters

str string
result Vector2
keywords IDictionary<string, Vector2>

Returns

bool

StringToVector3(string, out Vector3, IDictionary<string, Vector3>)

public static bool StringToVector3(string str, out Vector3 result, IDictionary<string, Vector3> keywords = null)

Parameters

str string
result Vector3
keywords IDictionary<string, Vector3>

Returns

bool

StringToVector3Offset(string, out Vector3, IDictionary<string, Vector3>)

public static bool StringToVector3Offset(string str, out Vector3 result, IDictionary<string, Vector3> keywords = null)

Parameters

str string
result Vector3
keywords IDictionary<string, Vector3>

Returns

bool

StringToWaveOffsetType(string, out WaveOffsetType, IDictionary<string, WaveOffsetType>)

public static bool StringToWaveOffsetType(string str, out AnimationUtility.WaveOffsetType result, IDictionary<string, AnimationUtility.WaveOffsetType> keywords = null)

Parameters

str string
result AnimationUtility.WaveOffsetType
keywords IDictionary<string, AnimationUtility.WaveOffsetType>

Returns

bool

TryParseTag(string, int, int, ref TagInfo, TagType)

Attempt to parse a tag from the substring of text given by startIndex and endIndex.

public static bool TryParseTag(string text, int startIndex, int endIndex, ref ParsingUtility.TagInfo tag, ParsingUtility.TagType type = TagType.Open | TagType.Close)

Parameters

text string

The full string.

startIndex int

Start index of the substring.

endIndex int

End index of the substring.

tag ParsingUtility.TagInfo

Reference to a ParsingUtility.TagInfo. Will be set to the parsed tag if successful.

type ParsingUtility.TagType

The type of tag to check for. Leave at default for either type.

Returns

bool

true if a tag was successfully parsed from the substring; false otherwise.