Seg$

seg$ extracts a substring defined by the starting position and the ending position out of a CLOB or a string.

Syntax

   seg$(EXP_STRING,EXP_POS1,EXP_POS2)

Examples

   # Extraction Of 3 characters from latin alphabet
   Local Char ALPHABET(26), DEF(20), WXYZ(20)
   ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
   DEF=seg$(ALPHABET,4,6) : # DEF contains "DEF"
   WXYZ=mid$(ALPHABET,23,26) : # DEF contains "WXYZ"
   # inserts a space between every character in a string
   MY_TITLE="WELCOME"
   MY_TITLE=sigma(I=1,len(MY_TITRE),mid$(TITRE,I,I)+" ")
   # Now MY_TITLE contains "W E L C O M E "

Description

The function seg$(EXP_STRING,EXP_POS,EXP_NB) extracts characters from the EXP_STRING string starting at the position EXP_POS1 until the position EXP_POS2.

The type of result is Char.

Comments

Associated errors

Error code Description
10 The type of argument is not correct.
50 At least one of the positions is negative.

See also

right$, left$, mid$, len.