ToSentenceCaseTransformation class
A transformation to convert a String into sentence case.
Sentence casing ensures that only the first letter of each sentence is capitalized. By default, acronyms are
excepted from conversion. However, if convertAcronyms is true
, they will also be converted with the same logic.
Sentences are demarcated by a period (.
), exclamation mark (!
), question mark (?
), colon (:
), or em dash
(—
), but punctuation is optional for the final sentence. Words within sentences are demarcated by whitespace,
which is retained in its original form after conversion to sentence casing.
final transformation = ToSentenceCaseTransformation(convertAcronyms: false);
// 'Here is some text, FYI. I hope you like it! Peace'
transformation.transform('here is some text, FYI. I hope you like it! peace', 'en_US');
- Inheritance
-
- Object
- Transformation<
String, String> - ToSentenceCaseTransformation
- Available Extensions
Constructors
- ToSentenceCaseTransformation({required bool convertAcronyms})
-
const
Properties
- convertAcronyms → bool
-
true
if acronyms should be converted, orfalse
to leave them capitalized.final - hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
transform(
String input, String locale) → String -
Transforms
input
into an instance ofU
using the providedlocale
.override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited