TINMAN 3D / REALTIME TERRAIN
Software Development Kit - User Manual

class FormattingUtil in Tinman.Core.Formatting

Helper class for dealing with unicode characters.

static class FormattingUtil  

Public / Attributes

NativeLineEnding

Returns the newline token of the underlying system.

public static property NativeLineEnding { get }
type LineEnding
value [not-null] The newline token.

Public / Methods

FormatDegrees

Formats an angle value: '123°'

[Pure]
public static method FormatDegrees (float64 value)
type string
params value The angle value, in degrees.
returns [not-null] The formatted angle value.

FormatMetric

Formats the given metric length in a readable way (e.g. '10.5 cm').

[Pure]
public static method FormatMetric (float64 length)
type string
params length The length, in metres.
returns [not-null] The formatted length string.

Remarks:

The metric unit is chosen (km, m, cm or mm) so that the resulting string has a minimum number of decimal digits..

FormatOnOff

Formats the given value as 'ON' resp. 'OFF'.

[Pure]
public static method FormatOnOff (bool value)
type string
params value The value.
returns [not-null] The formatted value.

FormatPercent

Formats a percent value: '100%'

[Pure]
public static method FormatPercent (float64 value)
type string
params value The decimal value.
returns [not-null] The formatted angle in degrees.

FormatRadians

Formats an angle value: '123°'

[Pure]
public static method FormatRadians (float64 value)
type string
params value The angle value, in radians.
returns [not-null] The formatted angle in degrees.

GetCategory

Returns the unicode category of the given character.

[Pure]
public static method GetCategory (char c)
type CharacterCategory
params c The character value.
returns The unicode category.

IsCategory

Checks if the given character belongs to any of the given categories.

[Pure]
public static method IsCategory (char c, CharacterCategory categories)
type bool
params c The character value.
  categories The character categories.
returns true if c has at least one category given by categories, false if not.

IsWhitespace

Checks if the given character is a whitespace.

[Pure]
public static method IsWhitespace (char c)
type bool
params c The character to check.
returns true if c is a whitespace, false if not.

Remarks:

Using this method is equivalent to calling IsCategory with the Whitespace and OtherControl flags. However, this method is more efficient.

Newline

Returns the newline token string.

[Pure]
public static method Newline (LineEnding lineEnding = LineEnding.Native)
type string
params lineEnding The line ending. Defaults to Native.
returns [not-null] The newline token.

Replaces a newline tokens in text with the specified newline token.

public static method Newline (string text, LineEnding lineEnding = LineEnding.Native)
type string
params text The text to normalize.
  lineEnding The line ending to use. Defaults to Native.
returns The normalized text or null if text was null.

TextToLines

Splits the given text into lines.

[Pure]
public static method TextToLines (string text, bool trim = false)
type string[]
params text [not-null] The text to split.
  trim Trim text lines? Defaults to false.
returns [not-null] The array of text lines.

ToLineEnding

Normalizes all line ending tokens in the given text.

public static method ToLineEnding (string text, LineEnding lineEnding = LineEnding.Native)
type string
params text [not-null] The input text.
  lineEnding The desired line ending type.
returns [not-null] The normalized text.