|
D.11.4.8 replace
Procedure from library findifs.lib (see findifs_lib).
- Usage:
- replace(s,what,with); s,what,with strings
- Return:
- string
- Purpose:
- replaces in 's' all the substrings 'what' with substring 'with'
- Note:
Example:
| LIB "findifs.lib";
" EXAMPLE:";
==> EXAMPLE:
ring r = (0,dt,theta),Tt,dp;
poly p = (Tt*dt+theta+1)^2+2;
string s = texfactorize("",p);
s;
==> $(dt^{2}\cdot Tt^{2}+(2dttheta+2dt)\cdot Tt+(theta^{2}+2theta+3))$
s = replace(s,"Tt","T_t"); s;
==> $(dt^{2}\cdot T_t^{2}+(2dttheta+2dt)\cdot T_t+(theta^{2}+2theta+3))$
s = replace(s,"dt","\\tri t"); s;
==> $(\tri t^{2}\cdot T_t^{2}+(2\tri ttheta+2\tri t)\cdot T_t+(theta^{2}+2the\
ta+3))$
s = replace(s,"theta","\\theta"); s;
==> $(\tri t^{2}\cdot T_t^{2}+(2\tri t\theta+2\tri t)\cdot T_t+(\theta^{2}+2\\
theta+3))$
|
|