NonNullableStringExtensions extension

Extensions on non-nullable String for common parsing and formatting.

on

Methods

capitalize() String

Available on String, provided by the NonNullableStringExtensions extension

Capitalizes the first letter of each word and lowercases the rest.
toCamelCase() String

Available on String, provided by the NonNullableStringExtensions extension

Converts snake_case or kebab-case to camelCase
toPascalCase() String

Available on String, provided by the NonNullableStringExtensions extension

Converts snake_case or kebab-case to PascalCase
toTryBool() bool?

Available on String, provided by the NonNullableStringExtensions extension

Tries to parse the string to a boolean. Returns true if string is 'true' (case-insensitive) or '1', false otherwise.
toTryDateTime({String? inputFormat}) DateTime?

Available on String, provided by the NonNullableStringExtensions extension

Tries to parse the string into a DateTime object.
toTryDouble() double?

Available on String, provided by the NonNullableStringExtensions extension

Tries to parse the string to a double. Returns null if parsing fails.
toTryInt() int?

Available on String, provided by the NonNullableStringExtensions extension

Tries to parse the string to an integer. Returns null if parsing fails.