s$ = ItemReplace$(s$,r$,n{,d$})

This function replaces a single item in a delimited string. (s$) is the delimited string, r$ is the item to replace and (n) is the item number to be replaced. As with all the delimited string functions the delimiter character (d$) is optional and will default to a comma if not specified.

The first item in a delimited string is item zero. This is to match item number to array indexes.

For example:

s$ = "zero,one,two,three,four"
s$ = ItemReplace$(s$,"new",2)

s$ now equals:

s$ = "zero,one,new,three,four"

Since the delimiter character is not specified a comma is assumed to be the delimiter.

Delimited Strings

Become a Patron