Class PluginChatCoordinateParser
- Namespace
- AcDream.Plugin.Abstractions
- Assembly
- AcDream.Plugin.Abstractions.dll
Parses compass coordinate pairs from ordinary chat text.
public static class PluginChatCoordinateParser
- Inheritance
-
PluginChatCoordinateParser
- Inherited Members
Methods
ParseAll(string?)
Finds every unambiguous coordinate pair in a message.
public static IReadOnlyList<PluginChatCoordinate> ParseAll(string? text)
Parameters
textstringThe chat text to search.
Returns
- IReadOnlyList<PluginChatCoordinate>
Each pair found, in the order it appears; empty for none. A pair is one north-or-south value and one east-or-west value, in either order, such as "42.1N 33.5E" or "33.5E, 42.1N". South and west come back negative.
TryParse(string?, out PluginChatCoordinate)
Parses exactly one coordinate pair and rejects ambiguous text.
public static bool TryParse(string? text, out PluginChatCoordinate coordinate)
Parameters
textstringThe text to parse.
coordinatePluginChatCoordinateThe pair, when the text holds exactly one.
Returns
- bool
True when the text holds exactly one pair; false for none or for more than one.