Wisej.Base.TextUtils
Namespace: Wisej.Base
Assembly: Wisej.Framework (4.0.0.0)
Provides utility methods to measure, encode, and extract mnemonics from text.
ConvertToString
Pluggable method used to convert user input to a string. Since 3.0.10
MeasureString
Pluggable method used to measure strings.
Applies the specified CharacterCasing rule to the text.
text
The text to modify according to the CharacterCasing rule.
casing
The CharacterCasing rule to apply to the text.
Returns: String.
Returns the correct string representation for value .
owner
Component that owns the value to convert to a string.
value
Value to convert to a string.
maxLength
Maximum length applied to the string; 0 = unlimited.
Returns: String. The correct string representation for value .
Escapes special characters in the specified string.
text
The text to escape.
Indicates that HTML tags should not be escaped. The default is false.
Returns: String. The escaped string. Null if the specified string was null, or empty if it was empty.
Removes the ampersand from the text and encodes HTML characters if necessary.
text
The text to convert.
allowHtml
Whether to encode HTML characters.
useMnemonic
Whether to convert the first mnemonic to an underlined character.
translateNewLines
Whether to convert newlines (CRLF) to <BR/>. The conversion is performed only when allowHtml is false, or, if allowHtml is true and the text doesn't contain any HTML.
Returns: String. The escaped string. Null if the specified string was null, or empty if it was empty.
Escapes HTML brackets and other HTML entities ready for being assigned to innerHTML without calling unescape() on the client.
text
Text to escape.
Returns: String. The escaped string, or an empty string if the string is null.
Removes the ampersand from the text and encodes HTML characters if necessary.
text
The text to convert.
allowHtml
Whether to encode HTML characters.
allowMarkdown
Whether to convert the text to HTML using the markdown syntax.
useMnemonic
Whether to convert the first mnemonic to an underlined character.
translateNewLines
Whether to convert newlines (CRLF) to <BR/>. The conversion is performed only when allowHtml is false, or, if allowHtml is true and the text doesn't contain any HTML.
Returns: String. The escaped string. Null if the string is empty.
Returns the height of the specified font .
font
Font to measure.
Returns: Int32. Height of font in pixels.
Returns the first character that is preceded by an ampersand (&).
text
The string from which to extract the mnemonic character.
Returns: String.
Returns the mnemonic character from the text.
text
Returns: String.
Returns the size of the specified text when rendered with the specified font.
text
The text to measure.
font
Returns: Size. The computed Size of the specified text.
Returns the size of the specified text when rendered with the specified font.
text
The text to measure.
font
format
Formatting information.
Returns: Size. The computed Size of the specified text.
Returns the size of the specified text when rendered with the specified font.
text
The text to measure.
font
layoutArea
Returns: Size.
Returns the size of the specified text when rendered with the specified font.
text
The text to measure.
font
layoutArea
format
Formatting information.
Returns: Size.
Returns the size of the specified text when rendered with the specified font.
text
The text to measure.
allowHtml
The text to measure may contain HTML tags.
font
callback
Result callback method, invoked when the client has finished measuring the text.
Returns the size of the specified text when rendered with the specified font.
text
The text to measure.
allowHtml
The text to measure may contain HTML tags.
font
width
The width to use as bounding rectangle for the text.
callback
Result callback method, invoked when the client has finished measuring the text.
Asynchronously returns the size of the specified text when rendered with the specified font. The measurement is performed on the browser. Returns an awaitable Task that contains the measured size.
text
The text to measure.
allowHtml
The text to measure may contain HTML tags.
font
The optional width to use as bounding rectangle for the text.
Returns: Task<Size>. An awaitable Task that represents the asynchronous operation.
allowHtml
The to apply to the measured text.
The to apply to the measured text.
The to apply to the measured text.
The to use as bounding rectangle for the text.
The to apply to the measured text.
The to use as bounding rectangle for the text.
The to apply to the measured text.
The to apply to the measured text.
The to apply to the measured text.
width