StringSlugExtensions extension
Extensions for generating URL-safe slugs and sanitizing filenames.
- on
Methods
-
sanitizeFilename(
{String replacement = '_', int maxLength = 0}) → String -
Available on String, provided by the StringSlugExtensions extension
Sanitizes this string for use as a filename: removes invalid characters and optional length cap. -
toSlug(
) → String -
Available on String, provided by the StringSlugExtensions extension
Converts this string to a URL-safe slug (lowercase, spaces/special → hyphen). -
toSlugWithMaxLength(
int maxLength) → String -
Available on String, provided by the StringSlugExtensions extension
Returns a slug with at mostmaxLengthcharacters, truncating at word boundaries when possible.