Guide

String

What @samline/string does, how it splits words and which function to use for each case, slug and text job.

@samline/string converts text between cases, builds URL slugs, searches without accents and shapes text for display, from code or straight from HTML attributes. Every function relies on the same word splitter, so XMLHttpRequest, xml-http-request and xml_http_request always agree.

JobFunctions
IdentifierscamelCase, pascalCase, kebabCase, snakeCase, dotCase, pathCase, constantCase, trainCase
Human texttitleCase, sentenceCase, capitalize, uncapitalize
URLs and accentsslugify, uniqueSlug, removeAccents, CYRILLIC, GREEK, GERMAN
Displaytruncate, initials, graphemes, hashColor
TextwordCount, readingTime, pluralize, template, escapeHtml, unescapeHtml, stripTags
Searchfold, contains, highlight, compareNatural, distance, similarity, closest
Conversions by nameconvert, CONVERSIONS, isConversion
HTML (/vanilla)data-string, data-string-search, data-string-count, data-string-fit, data-string-copy, data-string-color
Building blockswords

Choose your next step