<<

Contents

Search

>>

 

DELSUBSTR$

 

 

Function

 

 

Syntax:

DELSUBSTR$(<String>,<Separator>,<Number of Substring>)

 

<String>

= <STRING-EXPRESSION>

<Separator>

= <STRING-EXPRESSION>

<Number of Substring>

= <NUM-EXPRESSION>

 

 

Meaning:

Deletes a substring in a string which has separators.

 

<Separator> divides the <String> into several substrings. DELSUBSTR$ return a string in which the substring number <Number of Substring> in <String>  has been deleted.

 

If <Number of Substring> <= 0 or > number of substrings, <String> is returned.

 

Parameter:

String

String expression

Separator

Separator can contain more than 1 character.

Number of Substring

Number of substring

 

Sample:

H$ = "AAA;BBB;ccc"

SEP$ = ";"

S0$ = DELSUBSTR$(H$,SEP$,0) /* S0$ contains "AAA;BBB;ccc"

S1$ = DELSUBSTR$(H$,SEP$,1) /* S1$ contains "BBB;ccc"

S2$ = DELSUBSTR$(H$,SEP$,2) /* S2$ contains "AAA;ccc"

S3$ = DELSUBSTR$(H$,SEP$,3) /* S3$ contains "AAA;BBB"

S4$ = DELSUBSTR$(H$,SEP$,4) /* S4$ contains "AAA;BBB;ccc"

 

H$ = "Hello"

S1$ = DELSUBSTR$(H$,";",1)    /* S1$ contains ""

S2$ = DELSUBSTR$(H$,";",2)    /* S2$ contains "Hello"

 

H$ = "Test1;;Test2;"

S1$ = DELSUBSTR$(H$,";;",1)   /* S1$ contains "Test2;"

S2$ = DELSUBSTR$(H$,";;",2)   /* S2$ contains "Test1"

 

See also:

SUBSTR$

REPLSTR$

INSTR

INSTR_COUNT

STRSEP$