Skip to main content

replace

Replaces all occurrences of a substring in a string with a replacement string.

replace(searchString, substring, replacement)

Parameters#

  • searchString: The string to search within
  • substring: The string to find in searchString
  • replacement: The string to replace for each match of substring

Returns#

  • The replaced string

Example#

print(replace("Some dogs are funny. Some dogs are serious", 'dogs', 'cats'))# prints: Some cats are funny. Some cats are serious