LoginLogin

SUBST$ command tutorial

Root / Submissions / [.]

chemicalexCreated:
SUBST$ is a command that can replace part of a string. It looks like this.

Syntax

$NEWVAR=SUBST$(StartString,placement,ReplaceString,[CharacterCount])
  • StartString acts as the full string in which to replace text.
  • placement acts as a number that sets the start position to remove text.
  • ReplaceString acts as the string that will be replacing the removed text.
  • CharacterCount is an optional parameter that chooses how long the removed text will be, if left empty it will be one (I think)

Uses

This can be used in many situations like syntax replacement alongside INSTR.

Examples

Str$=SUBST$("Abcd", 2,"dc") 'Abdc

Str$=SUBST$("A cd",2,"b",2) 'Abd


If the last parameter is omitted, it will replace until the end of the string. The first example is incorrect; it should be Abdc

Replying to:12Me21
If the last parameter is omitted, it will replace until the end of the string. The first example is incorrect; it should be Abdc
Old thing but fixed anyway, thanks