text

Utilities for text and string manipulation.

Functions

Function
Description
Example

trim

Trim specific characters from string

dphelper.text.trim(s, c, b, e)

capitalize

Capitalize first letter of each word

dphelper.text.capitalize(txt)

lower

Convert string to lowercase

dphelper.text.lower(txt)

upper

Convert string to uppercase

dphelper.text.upper(txt)

nl2br

Convert newlines to <br> tags

dphelper.text.nl2br(str)

sanitize

Remove HTML tags from string

dphelper.text.sanitize(str)

camelCase.toSpace

Convert camelCase to space-separated

dphelper.text.camelCase.toSpace(str)

camelCase.toUnderscore

Convert camelCase to underscore

dphelper.text.camelCase.toUnderscore(str)

fitContainer

Auto-adjust font size to fit container

dphelper.text.fitContainer(selector)

keywords

Extract keywords from sentence

dphelper.text.keywords(sentence)

replaceText

Replace multiple patterns in text

dphelper.text.replaceText(text, replacements)

Description

Comprehensive text manipulation utilities:

  • Case Conversion - lower, upper, capitalize

  • HTML Conversion - nl2br, sanitize HTML tags

  • camelCase - Convert to/from space or underscore

  • Text Extraction - Extract keywords from text

  • Pattern Replacement - Multi-replacement operations

Usage Examples

Capitalize

Lower/Upper Case

Newlines to BR Tags

Remove HTML Tags

camelCase Conversions

Extract Keywords

Replace Multiple Patterns

Auto-fit Text to Container

Complete Form Processor

Details

  • Author: Dario Passariello

  • Version: 0.0.2

  • Creation Date: 20210101

  • Last Modified: 20260220

  • Environment: both (browser + Node.js)


Automatically generated document

Last updated