StringExtensions extension

Provides extended methods for String.

String用の拡張メソッドを提供します。

on

Methods

capitalize() String
Captialize and return String.
first({String separator = "/"}) String
Divides a String by separator and returns the first part.
format(List<Object> arg) String
Replaces String with the C printf format.
fromAES(String key) String
Decrypts AES-encrypted and Base64-encoded String.
fromBase64() String
Decodes Base64-encoded String.
fromBase64Url() String
Decodes Base64URL-encoded String.
isEmail() bool
Returns whether this string is an email address or not.
isEmoji() bool
Returns whether or not this string contains pictograms.
isURL() bool
Returns whether this string is a URL or not.
last({String separator = "/"}) String
Divides a String by separator and returns the last part.
limit(int length, {String suffix = "..."}) String
String with length to limit the number of characters.
parentPath({String separator = "/"}) String
String is divided by separator and moved one level up.
splitByBigram() List<String>
Convert String to Bigram, i.e., an array of two characters each.
splitByCharacter() List<String>
Converts String to an array of one character at a time.
splitByCharacterAndBigram() List<String>
Converts String into a one-character array and a two-character array.
splitByTrigram() List<String>
Convert String to Trigram, i.e., an array of 3 characters each.
splitLength({String separator = "/"}) int
Divides String by separator and returns the number of elements.
toAES(String key) String
Pass key of at least 32 characters to String for AES encryption.
toAny() → dynamic
Converts a String to a type that can be parsed as bool, int, or double, in that order, and returns the type as is.
toBase64() String
Encode String into a Base64 string.
toBase64Url() String
Encode String into a Base64URL string.
toBool([bool defaultValue = false]) bool
Converts String to bool.
toCamelCase() String
Convert String to CamelCase (first letter is lower case).
toDateTime([DateTime? defaultValue]) DateTime
Converts String to DateTime.
toDouble([double defaultValue = 0.0]) double
Converts String to double.
toHankakuNumericAndAlphabet() String
Converts alphabets and numbers to half-width characters.
toHiragana() String
Converts katakana to hiragana.
toInt([int defaultValue = 0]) int
Converts String to int.
toJsonList<T extends Object>([List<T> defaultValue = const []]) List<T>
Converts String to a Json-decoded List
toJsonMap<T extends Object>([Map<String, T> defaultValue = const {}]) Map<String, T>
Converts String to a Json-decoded Map<String, dynamic> object.
toJsonObject([Object? defaultValue]) → dynamic
Converts String to a Json-decoded object.
toKatakana() String
Converts hiragana into katakana.
toPascalCase() String
Convert String to Pascal case (first letter capitalized).
toRandomInt() int
Returns a unique random integer from a string.
toSHA1() String
Hash String with SHA1.
toSHA256(String password) String
Give password to String and hash it with HMAC-SHA256.
toSnakeCase() String
Convert String to snake case.
toUri() Uri?
Converts string to Uri.
toZenkakuKatakana() String
Converts half-width katakana to full-width katakana.
toZenkakuNumericAndAlphabet() String
Converts alphabets and numbers to full-width characters.
trimQuery() String
Trims URL query characters (after ?).
trimString(String chars) String
Trims the characters given by chars from before and after String.
trimStringLeft(String chars) String
Trims the characters given by chars from before String.
trimStringRight(String chars) String
Trims the characters given by chars from after String.