<<

Contents

Search

>>

 

REPLACE$

 

 

Function

 

 

Syntax:

REPLACE$(<Source String>,<String To Be Replaced>,<Replace By>,<Count>)

 

<Source String>

= <STRING-EXPRESSION>

<String To Be Replaced>

= <STRING-EXPRESSION>

<Replace By>

= <STRING-EXPRESSION>

<Count>

= <NUM-EXPRESSION>

 

 

Meaning:

Replaces substrings in a string.

 

REPLACE$ returns a string that results from the characters <String to Be Replaced> occurring in <Source String> being replaced by <Replace By>.

 

The parameter <Count> specifies how many character strings are replaced. If <Count> <= 0, all occurring strings are replaced, otherwise only the number defined.

 

Parameter:

Source String

String which is changed.

String To Be Replaced

Substring which has to be replaced.

Replace By

Specifies by what <String To Be Replaced> is replaced.

Count

Number ob replacements

 

Sample:

H$ = "HELLO"

H2$ = REPLACE$(H$,"L","XY",0) /* H2$ = "HEXYXYO"

H3$ = REPLACE$(H$,"L","l",1)  /* H3$ = "HElLO"

 

See also:

REPLSTR$

SUBSTR$

DELSUBSTR$