strtr_list - Translate substrings or replace substrings.
strtr_list(string,from,to)
This function returns a copy of string
where all occurrences of each character in from
have been translated to the corresponding character in to
, i.e., every occurrence of $from[$n]
has been replaced with $to[$n]
, where $n
is a valid offset in both arguments.
in: res=<{strtr_list("aa123bb456xx789",["a","b","x"],["cc","ddd","yyyy"])}>. out: res=cccc123dddddd456yyyyyyyy789. in: res=<{strtr_list("aa123bb456xx789",["a","b","x"],["cc","ddd","yyyy"])}>. out: res=cccc123dddddd456yyyyyyyy789. in: res=<{strtr_list("hello world, hi hhh",["h","hi","hello"],["-","hello","hi"])}>. out: res=hi world, hello ---. in: res=<{strtr_list("aa123bb456xx789",["a","b","x"],["cc","ddd","yyyy"])}>. out: res=cccc123dddddd456yyyyyyyy789.
{{ include("includes/strings.sn") }}
Written by Pusnei Sergey, <sergey@sednove.com>
1.0 2014-09-09 21:24:14 laplante@sednove.com
Edit© 2024 extenso Inc. All rights reserved.