Replace

Replace a sequence of characters in a string.

Syntax
      Replace(string, findStr, ReplaceStr, [start, [count, [compare]]])

Key
   string     The initial text string.

   findStr    The text string to search for in string.

   ReplaceStr The new string that will replace findStr in string.

   start      The position in string to begin the search.
              default=start (character 1)

   count      The number of occurrences to replace.
              default=replace all occurrences.

   compare    The comparison mode (Binary/Text)

The Replace() function may be used in VBA or in an SQL query.

Examples

Dim strDemo as String
strDemo = Replace("Don Quijote", "Quij", "Quix")
MsgBox StrDemo
Returns: Don Quixote

“The shooting of the movie is the truth part and the editing of the movie is the lying part, the deceit part” ~ Paul Hirsch

Related:

InStr - Return the position of one string within another.


© Copyright SS64.com 1999-2014
Some rights reserved