Mid statement (LotusScript® Language)

Replaces part or all of one string with characters from another string.

Syntax

Mid[$] ( stringVar , start [ , length ] ) = stringExpr

Elements

stringVar

A String variable, or a Variant variable containing a string value. The stringVar cannot be a literal string.

start

The position of the first character in stringVar that you want to replace.

length

Optional. The number of characters you want to use from stringExpr.

stringExpr

A string expression. Characters from stringExpr replace characters in stringVar.

Usage

Mid can alter the size of stringVar in bytes if you are working with multibyte characters. For example, if you are replacing a single-byte character with a double-byte character, the size of the string in bytes increases.

Otherwise, Mid does not alter the length of stringVar. That is, Mid does not append characters to stringVar. Mid uses as many characters of stringExpr as will fit in stringVar beginning at start and ending at start + length - 1.

To direct Mid to use all of stringExpr, either omit length, or specify a length greater than the length of the value in stringExpr.

If start is greater than the length of stringVar, LotusScript® generates an error.

Example