Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
2024.0.0 - Français


strsubst

substitute a character string by another in a character string

Syntax

string_out = strsubst(string_in, searchStr, replaceStr)
string_out = strsubst(string_in, searchStr, replaceStr, "regexp")

Arguments

string_in

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

searchStr

a character string. The string to search in string_in.

replaceStr

a character string. The replacement string.

string_out

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

"regexp" | "r" flag

Then searchStr is used as a regular expression.

Description

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.

Examples

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

See also

  • string — conversion en chaîne de caractères
  • strings — Scilab Object, character strings
Report an issue
<< strstr Chaînes de caractères strtod >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Tue Oct 24 14:34:15 CEST 2023