Articles in this section

dashcase helper

Converts a string into dashcase by replacing spaces, underscores, and other non-word characters with hyphens (-). Use it when you need consistent, URL-friendly or identifier-friendly formatting.

Usage

{{dashcase value}}
  • value (required): input string

Examples

  1. Convert a product name to dashcase

    {{dashcase record.product.name}}
    

    Input:

    {
      "record": {
        "product": {
          "name": "a-b-c d_e"
        }
      }
    }
    

    Output:

    a-b-c-d-e
    
  2. Convert a descriptive field

    {{dashcase record.category}}
    

    Input:

    {
      "record": {
        "category": "New Product Launch 2025"
      }
    }
    

    Output:

    new-product-launch-2025
    
  3. Split case-boundary

    {{dashcase record.camel}}

    Input

     { "record": { "camel": "getUserProfile" } }

    Output

    get-user-profile

Tip

  • All separators are normalized into a single -.

  • Useful for generating slugs, file names, or identifiers in APIs and URLs.

  • Multiple non-word characters in a row are collapsed into a single dash.

  • Inserts hyphens at camel/Pascal case boundaries and lowercases the final string.

  • Collapses multiple separators to a single hyphen and trims leading/trailing hyphens (result may be empty for inputs made only of separators).

  • Digits are preserved and participate in tokenization (e.g., "version-2_1-final" → version-2-1-final or per your tests, version-2-final when there’s spacing).

  • Non-string inputs (datatypes such as number or boolean) are converted to strings before processing. Arrays of primitive types (like strings or numbers) are converted into a comma-separated string before processing. If inputs are objects or object arrays, the output will be unusable.