StringTools - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : Names and Strings : StringTools Package : Pattern Matching : StringTools/Substitute

StringTools

  

Substitute

  

search for and replace the first occurrence of a string by another string

  

SubstituteAll

  

search for and replace all occurrences of a string by another string

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

Substitute( s, from, to )

SubstituteAll( s, from, to )

Parameters

s

-

string

from

-

string

to

-

string

Description

• 

The Substitute(s, from, to) function replaces the first occurrence of the string from in the string s by the string to, and returns the resulting string. The original string s is not modified. Strings are immutable in Maple.

• 

The SubstituteAll(s, from, to) function replaces all occurrences of from in s by to, and returns the resulting string. The original string s is not modified.

• 

Only the first of overlapping occurrences of from in s is subject to replacement by to.

Examples

withStringTools:

Substituteabuvcd,uv,UV

abUVcd

(1)

Substituteabvucd,uv,UV

abvucd

(2)

Substituteabuvuv,uv,UV

abUVuv

(3)

SubstituteAllabuvuv,uv,UV

abUVUV

(4)

SubstituteAllabababababab,aba,ABA

ABAbABAbABAb

(5)

See Also

SearchText

string

StringTools

StringTools[RegSubs]

 


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam