# BASIC 256 - Language Documentation

en:replace

## Replace

### Format

replace ( haystack , fromstring , tostring )
replace ( haystack , fromstring , tostring , caseinsensitive)

### Description

Return a new string where all occurrences or fromstring are replaced by tostring in the string haystack. You may also specify an optional boolean value caseinsensitive to specify that the search will treat upper and lower case letters the same.

### Example

    a$ = "We all live in a yellow submarine, yellow submarine, yellow submarine."
    print Replace(a$,"yellow","blue")
    print Replace(a$, "we", "Beatles", true)

will display

    We all live in a blue submarine, blue submarine, blue submarine.
    Beatles all live in a yellow submarine, yellow submarine, yellow submarine.

### New to Version

0.9.6.55

en/replace.txt · Last modified: 2011/03/29 11:56 (external edit)