Helper class for dealing with unicode characters.
static class
|
FormattingUtil
|
Returns the newline token of the underlying system.
public
static
property
|
NativeLineEnding
{
get
}
|
||
type
|
LineEnding
|
||
value
|
|
The newline token. |
Formats
an
angle
value:
'123°'
[Pure]
|
||||
public
static
method
|
FormatDegrees
(float64 value)
|
|||
type
|
string
|
|||
params
|
value
|
The angle value, in degrees. | ||
returns
|
|
The formatted angle value. |
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
|
|
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..
Formats
the
given
value
as
'ON'
resp.
'OFF'
.
[Pure]
|
||||
public
static
method
|
FormatOnOff
(bool value)
|
|||
type
|
string
|
|||
params
|
value
|
The value. | ||
returns
|
|
The formatted value. |
Formats
a
percent
value:
'100%'
[Pure]
|
||||
public
static
method
|
FormatPercent
(float64 value)
|
|||
type
|
string
|
|||
params
|
value
|
The decimal value. | ||
returns
|
|
The formatted angle in degrees. |
Formats
an
angle
value:
'123°'
[Pure]
|
||||
public
static
method
|
FormatRadians
(float64 value)
|
|||
type
|
string
|
|||
params
|
value
|
The angle value, in radians. | ||
returns
|
|
The formatted angle in degrees. |
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. |
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.
|
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.
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
|
|
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 .
|
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
|
|
The array of text lines. |
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
|
|
The normalized text. |