<<

Contents

Search

>>

 

REPLSTR$

 

 

Function

 

 

Syntax:

REPLSTR$(<Source String>,<Separator>,<Number >,<Replace By>)

 

<Source String>

= <STRING-EXPRESSION>

<Separator>

= <STRING-EXPRESSION>

<Number>

= <NUM-EXPRESSION>

<Replace By>

= <STRING-EXPRESSION>

 

 

Meaning:

Replaces a substring in a string which has separators.

 

<Source String> is divided into various substrings by <Separator>.

 

In the <Source String> the substring number <Number> is replaced by <Replace By>.

 

REPLSTR$ returns this changed string. 

 

If <Number> <= 0, the first substring is replaced.

 

If <Number> is bigger than the number of the substrings in <Source String>, as many <Seperators> as needed are inserted.

 

Parameter:

Source String

String to be changed

Separator

The Separator can consist of more than one character.

Number

Number of the substring to be replaced

Replace By

Replace string

 

Sample:

H$ = "AAA;BBB;@ccc;DDD"

SEP$ = ";@"

H2$ = REPLSTR$(H$,SEP$,2,"New value")

/* H2$ enthält: "AAA;BBB;@New value"

 

H$ = ""

H2$ = REPLSTR$(H$,";",3,"New value")

/* H2$ enthält: ";;New value"

 

See also:

SUBSTR$

DELSUBSTR$

REPLACE$

INSTR

STRSEP$