> For the complete documentation index, see [llms.txt](https://docs.squidex.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.squidex.io/id-02-documentation/developer-guides/scripting/scripting-helper-methods.md).

# Scripting Helper Methods

The following helper methods are not part of the ES5 JavaScript standard, but they are very helpful for a lot of use cases.

<table><thead><tr><th width="299">Name</th><th>Description</th></tr></thead><tbody><tr><td><code>html2Text(text)</code></td><td>Converts a HTML string to plain text.</td></tr><tr><td><code>markdown2Text(text)</code></td><td>Converts a markdown string to plain text.</td></tr><tr><td><code>formatDate(date,pattern)</code></td><td>Formats a JavaScript date object using the specified pattern.</td></tr><tr><td><code>formatTime(date,pattern)</code></td><td>Same as <code>formatDate</code>.</td></tr><tr><td><code>wordCount(text)</code></td><td>Counts the number of words in a text. Useful in combination with <code>html2Text</code> or <code>markdown2Text</code>.</td></tr><tr><td><code>characterCount(text)</code></td><td>Counts the number of characters in a text. Useful in combination with <code>html2Text</code> or <code>markdown2Text</code>.</td></tr><tr><td><code>toCamelCase(text)</code></td><td>Converts a text to camelCase.</td></tr><tr><td><code>toPascalCase(text)</code></td><td>Converts a text to PascalCase.</td></tr><tr><td><code>sha256(text)</code></td><td>Calculate the SHA256 hash from a given string. Use this method for hashing passwords.</td></tr><tr><td><code>md5(text)</code></td><td>Calculate the MD5 hash from a given string. Use this method for hashing passwords, when backwards compatibility is important.</td></tr><tr><td><code>slugify(text)</code></td><td>Calculates the slug of a text by removing all special characters and whitespaces to create a friendly term that can be used for SEO-friendly URLs.</td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.squidex.io/id-02-documentation/developer-guides/scripting/scripting-helper-methods.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
