← All procedures

client.substring

Extract substring from start to end index

browsernot registered
Package
@procedures/client · README
Path
["client","substring"]
CLI
Not a mark command: it is not in the default registry.
As data
{"$proc":["client","substring"],"input":{}}
Tags
core, string

Try it in the Composer →

Use it

In TypeScript

import { Client, LocalTransport, PROCEDURE_REGISTRY, allCoreProcedures } from "@procedures/client";

for (const procedure of allCoreProcedures) {
  if (!PROCEDURE_REGISTRY.has(procedure.path)) PROCEDURE_REGISTRY.register(procedure);
}

const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["client","substring"], { value: "<value>", start: 1 });
console.log(JSON.stringify(result));

As data, in a program

{
  "$proc": ["client", "substring"],
  "input": { "value": "<value>", "start": 1 }
}

Input

FieldTypeRequired
valuestringyes
startnumberyes
endnumberno

Output

The schema does not list fields (string).

JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "value": {
        "type": "string",
        "description": "The value"
      },
      "start": {
        "type": "number",
        "description": "The start position (inclusive)"
      },
      "end": {
        "description": "The end position (exclusive)",
        "type": "number"
      }
    },
    "required": [
      "value",
      "start"
    ]
  },
  "output": {
    "type": "string",
    "description": "The part of the string"
  }
}