SDU
Personal tools

Gsub

From SDU

Jump to: navigation, search
To make corrections or additions to this article, select the edit tab above.
To discuss or ask questions about this article, select the discussion tab above.

Overview

A spell function returning the string with every occurence of a given pattern replaced by another string.

Usage

string gsub(strSource, strRegEx, strReplacement);
  • strSource - source string to be replaced
  • strRegEx - regular expression pattern
  • strReplacement - by which string should be pattern replaced

Results

Returns changed string or the same string if pattern does not match.

Examples

  • Convert several lines to a one comma separated string
gsub(errorStr,"\n", ", ")
This page was last modified 12:41, 8 September 2010.  This page has been accessed 949 times.  Content is available under Attribution-Noncommercial-Share Alike 3.0 UnportedDisclaimers