Scilab Home page | Wiki | Bug tracker | Forge | Mailing list archives | ATOMS | File exchange
Please login or create an account
Change language to: Français - Português - 日本語 - Русский

Please note that the recommended version of Scilab is 6.1.1. This page might be outdated.
See the recommended documentation of this function

Scilab Help >> Strings > strsubst


substitute a character string by another in a character string

Calling Sequence

string_out = strsubst(string_in, searchStr, replaceStr)
string_out = strsubst(string_in, searchStr, replaceStr, [flag])



a matrix of character strings. The strings where to search occurrences of searchStr.


a character string. The string to search in string_in.


a character string. The replacement string.


a matrix of character strings. The result of the substitution on searchStr by replaceStr in string_in.


a character ("r" for regular expression).


The strsubst function replaces all occurrences of searchStr in string_in by replaceStr.

When using the forth parameter "r", the searchStr should be a string of regular expression. And then strsubst is going to match it with string_in and replace according to the regular expression rules.


strsubst('SCI/demos/scicos','/',' ')
strsubst('2' ,'/2(]*)?$\1/' ,'0','r')

See Also

  • string — conversion to string
  • strings — Scilab Object, character strings
Scilab Enterprises
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Fri Apr 11 14:06:54 CEST 2014