$substitute()

DESCRIPTION in a string, replace a substring with another substring at the specified instance of the first substring or: in a string, replace every instance of a substring with another substring
SYNOPSIS
    $substitute(s1,s2,s3,i)

    or:

    $substitute(s1,s2,s3)
ARGUMENTS
    s1 - a quoted string, or string expression
    s2 - a quoted string, or string expression
    s3 - a quoted string, or string expression
     i - a positive integer, or integer expression, greater than or equal to one

    or:

    s1 - a quoted string, or string expression
    s2 - a quoted string, or string expression
    s3 - a quoted string, or string expression
EXAMPLES
# pikt +C 'output $substitute("she loves me yeah yeah yeah","yeah","no",1)'
she loves me no yeah yeah

# pikt +C 'output $substitute("she loves me yeah yeah yeah","yeah","no",2)'
she loves me yeah no yeah

# pikt +C 'output $substitute("she loves me yeah yeah yeah","yeah","no",3)'
she loves me yeah yeah no

# pikt +C 'output $substitute("she loves me yeah yeah yeah","yeah","no",4)'
she loves me yeah yeah yeah

# pikt +C 'output $substitute("she loves me yeah yeah yeah","yeah","no")'
she loves me no no no

# pikt +C 'output $substitute("she loves me yeah yeah yeah","yeah","")'
she loves me

# pikt +C 'output $substitute($substitute("she loves me yeah yeah yeah","yeah",""),"loves","hates",1)'
she hates me
SEE ALSO
    $replace()

    String Functions
    Numerical Functions
 
Home | FAQ | News | Intro | Samples | Tutorial | Reference | Software
Developer's Notes | Licensing | Authors | Pikt-Users | Pikt-Workers | Related Projects | Site Index | Privacy Policy | Contact Us
Page best viewed at 1024x768 or greater.   Page last updated 2019-01-12.   This site is PIKT® powered.
Copyright © 1998-2019 Robert Osterlund. All rights reserved.
Home FAQ News Intro Samples Tutorial Reference Software
PIKT Logo
PIKT Page Title
Learn about
the Pikt script
init section