---
category: [Administration & Integrations, Administration & Integrations/Custom Integrations & Apps, Platform and Product Extensions, Platform and Product Extensions/Workday Extend, Platform and Product Extensions/Integration]
keyword: [Extend, Orchestration Builder, Orchestrate, Orchestration]
nav: wcp_docs
parent_url: /wcp_docs/
title: >- 
  Reference: Text Member Functions
layout: subsection
---

<a id="section_N10021_N1001E_N10001"></a>
<b>Instance Type: Text</b>

<table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td>batchIteratorByContainsAfter</td><td>Arguments: <ul><li>contains (String)
</li></ul> <p>Return Type:</p><ul><li>TextIterator
</li></ul> <p>Returns an iterator of TextType instance batches. The batch is created after lines that contain the specified string.</p></td></tr><tr><td>batchIteratorByContainsAfter</td><td>Arguments: <ul><li>contains (String)
</li><li>lineEnding (String)
</li></ul> <p>Return Type:</p><ul><li>TextIterator
</li></ul> <p>Returns an iterator of TextType instance batches. The batch is created after lines that contain the specified string. The lineEnding parameter defines the end of a line.</p></td></tr><tr><td>batchIteratorByContainsAt</td><td>Arguments: <ul><li>contains (String)
</li></ul> <p>Return Type:</p><ul><li>TextIterator
</li></ul> <p>Returns an iterator of TextType instance batches. The batch is created at lines that contain the specified string.</p></td></tr><tr><td>batchIteratorByContainsAt</td><td>Arguments: <ul><li>contains (String)
</li><li>lineEnding (String)
</li></ul> <p>Return Type:</p><ul><li>TextIterator
</li></ul> <p>Returns an iterator of TextType instance batches. The batch is created at lines that contain the specified string. The lineEnding parameter defines the end of a line.</p></td></tr><tr><td>batchIteratorByEndsWithAfter</td><td>Arguments: <ul><li>endsWith (String)
</li></ul> <p>Return Type:</p><ul><li>TextIterator
</li></ul> <p>Returns an iterator of TextType instance batches. The batch is created after lines that end with the specified string.</p></td></tr><tr><td>batchIteratorByEndsWithAfter</td><td>Arguments: <ul><li>endsWith (String)
</li><li>lineEnding (String)
</li></ul> <p>Return Type:</p><ul><li>TextIterator
</li></ul> <p>Returns an iterator of TextType instance batches. The batch is created after lines that end with the specified string. The lineEnding parameter defines the end of a line.</p></td></tr><tr><td>batchIteratorByEndsWithAt</td><td>Arguments: <ul><li>endsWith (String)
</li></ul> <p>Return Type:</p><ul><li>TextIterator
</li></ul> <p>Returns an iterator of TextType instance batches. The batch is created at lines that end with the specified string.</p></td></tr><tr><td>batchIteratorByEndsWithAt</td><td>Arguments: <ul><li>endsWith (String)
</li><li>lineEnding (String)
</li></ul> <p>Return Type:</p><ul><li>TextIterator
</li></ul> <p>Returns an iterator of TextType instance batches. The batch is created at lines that end with the specified string. The lineEnding parameter defines the end of a line.</p></td></tr><tr><td>batchIteratorByStartsWithAfter</td><td>Arguments: <ul><li>startsWith (String)
</li></ul> <p>Return Type:</p><ul><li>TextIterator
</li></ul> <p>Returns an iterator of TextType instance batches. The batch is created after lines that start with the specified string.</p></td></tr><tr><td>batchIteratorByStartsWithAfter</td><td>Arguments: <ul><li>startsWith (String)
</li><li>lineEnding (String)
</li></ul> <p>Return Type:</p><ul><li>TextIterator
</li></ul> <p>Returns an iterator of TextType instance batches. The batch is created after lines that start with the specified string. The lineEnding parameter defines the end of a line.</p></td></tr><tr><td>batchIteratorByStartsWithAt</td><td>Arguments: <ul><li>startsWith (String)
</li></ul> <p>Return Type:</p><ul><li>TextIterator
</li></ul> <p>Returns an iterator of TextType instance batches. The batch is created at lines that start with the specified string.</p></td></tr><tr><td>batchIteratorByStartsWithAt</td><td>Arguments: <ul><li>startsWith (String)
</li><li>lineEnding (String)
</li></ul> <p>Return Type:</p><ul><li>TextIterator
</li></ul> <p>Returns an iterator of TextType instance batches. The batch is created at lines that start with the specified string. The lineEnding parameter defines the end of a line.</p></td></tr><tr><td>dropFirstAndLastLines</td><td>Arguments: <ul><li>firstN (Number)
</li><li>lastN (Number)
</li></ul> <p>Return Type:</p><ul><li>Text
</li></ul> <p>Returns a new TextType instance with the first n and last n lines removed.</p></td></tr><tr><td>dropFirstAndLastLines</td><td>Arguments: <ul><li>firstN (Number)
</li><li>lastN (Number)
</li><li>lineEnding (String)
</li></ul> <p>Return Type:</p><ul><li>Text
</li></ul> <p>Returns a new TextType instance with the first n and last n lines removed. The lineEnding parameter defines the end of a line.</p></td></tr><tr><td>dropFirstLines</td><td>Arguments: <ul><li>firstN (Number)
</li></ul> <p>Return Type:</p><ul><li>Text
</li></ul> <p>Returns a new TextType instance with the first n lines removed.</p></td></tr><tr><td>dropFirstLines</td><td>Arguments: <ul><li>firstN (Number)
</li><li>lineEnding (String)
</li></ul> <p>Return Type:</p><ul><li>Text
</li></ul> <p>Returns a new TextType instance with the first n lines removed. The lineEnding parameter defines the end of a line.</p></td></tr><tr><td>dropLines</td><td>Arguments: <ul><li>n (Number)
</li></ul> <p>Return Type:</p><ul><li>Text
</li></ul> <p>Returns a new TextType instance with the specified number of lines removed from the end.</p></td></tr><tr><td>dropLines</td><td>Arguments: <ul><li>n (Number)
</li><li>lineEnding (String)
</li></ul> <p>Return Type:</p><ul><li>Text
</li></ul> <p>Returns a new TextType instance with the specified number of lines removed from the end. The lineEnding parameter defines the end of a line.</p></td></tr><tr><td>dropLines</td><td>Arguments: <ul><li>from (Number)
</li><li>to (Number)
</li></ul> <p>Return Type:</p><ul><li>Text
</li></ul> <p>Returns a new TextType instance with the lines between the specified points removed.</p></td></tr><tr><td>dropLines</td><td>Arguments: <ul><li>from (Number)
</li><li>to (Number)
</li><li>lineEnding (String)
</li></ul> <p>Return Type:</p><ul><li>Text
</li></ul> <p>Returns a new TextType instance with the lines between the specified points removed. The lineEnding parameter defines the end of a line.</p></td></tr><tr><td>escapeToJsonString</td><td>Arguments: <ul><li>None
</li></ul> <p>Return Type:</p><ul><li>Text
</li></ul> <p>Returns the text escaped for JSON so it can be inserted into a document as a JSON field string value.</p><p><b>Note:</b> This function doesn't surround the resulting string with double quotes. Use toJsonStringValue to do that.</p></td></tr><tr><td>firstLine</td><td>Arguments: <ul><li>None
</li></ul> <p>Return Type:</p><ul><li>Text
</li></ul> <p>Returns the first line as a StringType instance.</p></td></tr><tr><td>firstLine</td><td>Arguments: <ul><li>lineEnding (String)
</li></ul> <p>Return Type:</p><ul><li>Text
</li></ul> <p>Returns the first line as a StringType instance. The lineEnding parameter defines the end of a line.</p></td></tr><tr><td>htmlToPlainText</td><td>Arguments: <ul><li>None
</li></ul> Return Type: <ul><li>Text
</li></ul> <p>Returns HTML input as readable plain text. Block-level elements (p, div, br, li, h1-h6) each produce a line break. Example: "<p>First<br/><b>Second</b></p>" returns "First\nSecond".</p> <p>Runs of consecutive block-level boundaries collapse to a single line break. Leading and trailing line breaks are trimmed. Inline elements are removed, retaining their text content. Runs of whitespace are collapsed to a single space. HTML entities are decoded, including numeric and hexadecimal references that resolve to control characters, bidirectional text override characters, or invisible/zero-width characters; unlike decodeHtmlEntities(), no safe decoding filtering is applied here. Tags are removed regardless of their length, including tags carrying large embedded content such as base64 image data. Text that ends inside an unterminated tag (an opening bracket with no matching closing bracket) can cause the step to throw an error.</p> <p>Intended for reducing HTML markup in small rich-text snippets (example: before sending text to an LLM). Not a general HTML sanitizer and not suitable for injection or XSS control.</p></td></tr><tr><td>includeCharactersUsingList</td><td>Arguments: <ul><li>inclusionList (StringListType)
</li><li>defaultReplacement (StringType)
</li></ul> Return Type: <ul><li>Text
</li></ul> Returns a text file, replacing any characters not present in the inclusion list with the specified replacement. Characters that are on the inclusion list are returned unchanged.</td></tr><tr><td>lastLine</td><td>Arguments: <ul><li>None
</li></ul> <p>Return Type:</p><ul><li>Text
</li></ul> <p>Returns the last line as a StringType instance.</p></td></tr><tr><td>lastLine</td><td>Arguments: <ul><li>lineEnding (String)
</li></ul> <p>Return Type:</p><ul><li>Text
</li></ul> <p>Returns the last line as a StringType instance. The lineEnding parameter defines the end of a line.</p></td></tr><tr><td>line</td><td>Arguments: <ul><li>n (Number)
</li></ul> <p>Return Type:</p><ul><li>String
</li></ul> <p>Returns the line at the specified line number as a StringType instance.</p></td></tr><tr><td>line</td><td>Arguments: <ul><li>n (Number)
</li><li>lineEnding (String)
</li></ul> <p>Return Type:</p><ul><li>String
</li></ul> <p>Returns the line at the specified line number as a StringType instance. The lineEnding parameter defines the end of a line.</p></td></tr><tr><td>lineCount</td><td>Arguments: <ul><li>None
</li></ul> <p>Return Type:</p><ul><li>Number
</li></ul> <p>Returns the number of lines in this TextType instance.</p></td></tr><tr><td>lineCount</td><td>Arguments: <ul><li>lineEnding (String)
</li></ul> <p>Return Type:</p><ul><li>Number
</li></ul> <p>Returns the number of lines in this TextType instance. The lineEnding parameter defines the end of a line.</p></td></tr><tr><td>lines</td><td>Arguments: <ul><li>None
</li></ul> <p>Return Type:</p><ul><li>StringIterator
</li></ul> <p>Returns an iterator of StringIteratorType, which when used in a loop provides each line of text as a StringType instance.</p></td></tr><tr><td>lines</td><td>Arguments: <ul><li>from (Number)
</li><li>to (Number)
</li></ul> <p>Return Type:</p><ul><li>StringIterator
</li></ul> <p>Returns an iterator of StringIteratorType, which when used in a loop provides each line of text as a StringType instance. Skips the lines between the specified points.</p></td></tr><tr><td>lines</td><td>Arguments: <ul><li>from (Number)
</li></ul> <p>Return Type:</p><ul><li>StringIterator
</li></ul> <p>Returns an iterator of StringIteratorType, which when used in a loop provides each line of text as a StringType instance. Starts at the specified point.</p></td></tr><tr><td>lines</td><td>Arguments: <ul><li>lineEnding (String)
</li></ul> <p>Return Type:</p><ul><li>StringIterator
</li></ul> <p>Returns an iterator of StringIteratorType, which when used in a loop provides each line of text as a StringType instance. The lineEnding parameter defines the end of a line.</p></td></tr><tr><td>lines</td><td>Arguments: <ul><li>from (Number)
</li><li>to (Number)
</li><li>lineEnding (String)
</li></ul> <p>Return Type:</p><ul><li>StringIterator
</li></ul> <p>Returns an iterator of StringIteratorType, which when used in a loop provides each line of text as a StringType instance. Includes the lines from the start point to the end point. The lineEnding parameter defines the end of a line.</p></td></tr><tr><td>lines</td><td>Arguments: <ul><li>from (Number)
</li><li>lineEnding (String)
</li></ul> <p>Return Type:</p><ul><li>StringIterator
</li></ul> <p>Returns an iterator of StringIteratorType, which when used in a loop provides each line of text as a StringType instance. Starts at the specified point. The lineEnding parameter defines the end of a line.</p></td></tr><tr><td>removeEmptyLines</td><td>Arguments: <ul><li>None
</li></ul> <p>Return Type:</p><ul><li>Text
</li></ul> <p>Returns the text with empty lines removed. Works with \n, \r and \r\n line endings.</p></td></tr><tr><td>removeEmptyLines</td><td>Arguments: <ul><li>lineSeparator (String)
</li></ul> <p>Return Type:</p><ul><li>Text
</li></ul> <p>Returns the text with empty lines removed according to the specified line separator.</p></td></tr><tr><td>replaceAndIncludeCharacters</td><td>Arguments: <ul><li>mapping (StringMapType)
</li><li>defaultReplacement (StringType)
</li></ul> Return Type: <ul><li>Text
</li></ul> Returns a text file with characters replaced according to the provided mapping. If a character is missing from the provided document, the default string is returned in its place. Spaces and new lines are returned unchanged.</td></tr><tr><td>replaceCharactersUsingMapping</td><td>Arguments: <ul><li>mapping (StringMapType)
</li></ul> Return Type: <ul><li>Text
</li></ul> Returns a text file with characters replaced according to the provided mapping. If a character isn't mapped, it's returned unchanged.</td></tr><tr><td>sanitizeHtml</td><td>Arguments: <ul><li>allowedTags (String)
</li></ul> <p>Return Type:</p><ul><li>Text
</li></ul> <p>Returns the input text with all HTML/XML tags removed except those in the comma-separated allowedTags list. Does not decode HTML entities.</p> <p>The text content of removed elements is preserved. Allowed tags are preserved verbatim, including their attributes. Attributes are not inspected or filtered, so an allowed tag can still carry event handlers or script URLs (example: onerror= or href="javascript:...").</p> <p>Intended for reducing HTML markup in small rich-text snippets (example: before sending text to an LLM). Not a general HTML sanitizer and not suitable for injection or XSS control. Don't use this function to make untrusted HTML safe to render. Script and style elements and their content are always removed entirely, even if "script" or "style" appear in allowedTags.</p> <p>Tags are handled regardless of their length, including tags carrying large embedded content such as base64 image data: an allowed tag of any length is preserved, and any other tag of any length is removed. Text that ends inside an unterminated tag (an opening bracket with no matching closing bracket) can cause the step to throw an error. Example with <b> and <i> as allowed tags: "<b>Hello</b><script>alert(1)</script><i>world</i>".sanitizeHtml("b,i") returns "<b>Hello</b><i>world</i>".</p></td></tr><tr><td>stripHtmlTags</td><td>Arguments: <ul><li>None
</li></ul> Return Type: <ul><li>Text
</li></ul> <p>Returns the input text with all HTML/XML tags removed. Does not decode HTML entities. Example: "Hello <b>world</b>" returns "Hello world".</p> <p>Tags are removed regardless of their length, including tags carrying large embedded content such as base64 image data. Text that ends inside an unterminated tag (an opening bracket with no matching closing bracket) can cause the step to throw an error.</p> <p>Intended for reducing HTML markup in small rich-text snippets (example: before sending text to an LLM). Not a general HTML sanitizer and not suitable for injection or XSS control.</p></td></tr><tr><td>toJsonStringValue</td><td>Arguments: <ul><li>None
</li></ul> <p>Return Type:</p><ul><li>Json
</li></ul> <p>Returns the text escaped for JSON and surrounded in double quotes so it can be inserted into a JSON document as a field string value.</p></td></tr></tbody></table><br/>

