/extract-substring

This endpoint is useful for extracting a specific substring from a given string based on either positional or text pattern parameters.

Method: GET

Query Parameters

  • str (required, string): The input string from which a substring needs to be extracted.
  • start (required, integer): The starting index for the substring extraction (non-negative integer).
  • length (required, integer): The number of characters to extract (non-negative integer).

Example Call

Request:

curl -X GET "https://node.nodetrigger.com/extract-substring?str=HelloWorld&start=0&length=5"

Response:

{
    "substring": "Hello"
}

Real-Life Examples

  1. Example 1: Extracting a Simple Substring To extract the first 5 characters from the string “HelloWorld”: Request:
   curl -X GET "https://node.nodetrigger.com/extract-substring?str=HelloWorld&start=0&length=5"

Response:

   {
       "substring": "Hello"
   }
  1. Example 2: Extracting a Substring from the Middle To extract 3 characters starting from index 4 from the string “OpenAIBot”: Request:
   curl -X GET "https://node.nodetrigger.com/extract-substring?str=OpenAIBot&start=4&length=3"

Response:

   {
       "substring": "AIB"
   }