ConvertString extension

Extension methods for String to provide various utilities for string manipulation, encoding, decoding, and hashing.

This extension adds methods to the String class for tasks such as hashing the string using MD5, converting between different encoding formats (Base64, Base32), converting a string to an ObjectId, and generating slugs.

on

Properties

oID → ObjectId?
Converts the string to an ObjectId, or returns null if the string is not a valid ObjectId.
no setter

Methods

fromBase32({String def = ''}) String
Decodes the string from Base32 encoding and returns the resulting string.
fromBase64({String def = ''}) String
Decodes the string from Base64 encoding and returns the resulting string.
isSlug() bool
Checks if the string is a valid slug.
toBase32() String
Encodes the string to Base32 format.
toBase64() String
Encodes the string to Base64 format.
toMd5() String
Computes the MD5 hash of the string and returns it as a hexadecimal String.
toSlug() String
Converts the string to a slug by replacing spaces and non-alphanumeric characters.