StringTextExtensions extension
Extensions on String for words, grammar, lines, and text display.
- on
Methods
-
collapseMultilineString(
{required int cropLength, bool appendEllipsis = true}) → String -
Available on String, provided by the StringTextExtensions extension
Returns this multiline string collapsed into a single line, truncated tocropLengthcharacters. -
compressSpaces(
{bool trim = true}) → String? -
Available on String, provided by the StringTextExtensions extension
Returns the result of collapsing consecutive whitespace, ornullif empty. Alias forremoveConsecutiveSpaces. -
firstLines(
int limit) → String -
Available on String, provided by the StringTextExtensions extension
Returns the firstlimitlines of this string. -
firstWord(
) → String? -
Available on String, provided by the StringTextExtensions extension
Returns the first word of this string, ornullif empty. -
grammarArticle(
) → String -
Available on String, provided by the StringTextExtensions extension
Returns the appropriate indefinite article ('a'or'an') for this word, or an empty string if input is empty. -
multiLinePrefix(
String insertText, {bool prefixEmptyStrings = false}) → String -
Available on String, provided by the StringTextExtensions extension
Returns a new string withinsertTextprepended to every line. -
pluralize(
num? count, {bool simple = false}) → String -
Available on String, provided by the StringTextExtensions extension
Returns the plural form of this string based oncount. -
possess(
{bool isLocaleUS = true}) → String -
Available on String, provided by the StringTextExtensions extension
Returns the possessive form of this string (e.g., "John's", "boss'"). -
removeConsecutiveSpaces(
{bool trim = true}) → String? -
Available on String, provided by the StringTextExtensions extension
Returns a new string with consecutive whitespace collapsed into a single space, ornullif the result is empty. -
removeSingleCharacterWords(
{bool trim = true, bool removeMultipleSpaces = true}) → String? -
Available on String, provided by the StringTextExtensions extension
Returns a new string with single-character words removed, ornullif the result is empty. -
secondWord(
) → String? -
Available on String, provided by the StringTextExtensions extension
Returns the second word of this string, ornullif fewer than two words. -
splitCapitalizedUnicode(
{bool splitNumbers = false, bool splitBySpace = false, int minLength = 1}) → List< String> -
Available on String, provided by the StringTextExtensions extension
Returns a list of segments split at capitalized letters (Unicode-aware). -
trimLines(
) → String -
Available on String, provided by the StringTextExtensions extension
Returns a new string with each line trimmed and empty lines removed. -
trimWithEllipsis(
{int minLength = 5}) → String -
Available on String, provided by the StringTextExtensions extension
Returns a truncated version of this string with ellipsis, keeping the first and lastminLengthcharacters. -
words(
) → List< String> ? -
Available on String, provided by the StringTextExtensions extension
Returns this string split into a list of words, ornullif empty.