<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://ubersoft.org/Sputnik/wiki/skins/common/feed.css?301"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
		<id>http://ubersoft.org/Sputnik/wiki/index.php?action=history&amp;feed=atom&amp;title=Core_Function_StrTr</id>
		<title>Core Function StrTr - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://ubersoft.org/Sputnik/wiki/index.php?action=history&amp;feed=atom&amp;title=Core_Function_StrTr"/>
		<link rel="alternate" type="text/html" href="http://ubersoft.org/Sputnik/wiki/index.php?title=Core_Function_StrTr&amp;action=history"/>
		<updated>2026-04-11T21:45:05Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.17.0</generator>

	<entry>
		<id>http://ubersoft.org/Sputnik/wiki/index.php?title=Core_Function_StrTr&amp;diff=5925&amp;oldid=prev</id>
		<title>UberFoX: Created page with &quot;&lt;pre&gt; StrTr( &lt;str&gt;, &lt;from&gt;, &lt;to&gt; ) StrTr( &lt;str&gt;, &lt;replace_pairs&gt; ) &lt;/pre&gt;  === Description ===  If given three arguments, this function returns a copy of str where all occurrence...&quot;</title>
		<link rel="alternate" type="text/html" href="http://ubersoft.org/Sputnik/wiki/index.php?title=Core_Function_StrTr&amp;diff=5925&amp;oldid=prev"/>
				<updated>2015-09-19T18:46:19Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;lt;pre&amp;gt; StrTr( &amp;lt;str&amp;gt;, &amp;lt;from&amp;gt;, &amp;lt;to&amp;gt; ) StrTr( &amp;lt;str&amp;gt;, &amp;lt;replace_pairs&amp;gt; ) &amp;lt;/pre&amp;gt;  === Description ===  If given three arguments, this function returns a copy of str where all occurrence...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
StrTr( &amp;lt;str&amp;gt;, &amp;lt;from&amp;gt;, &amp;lt;to&amp;gt; )&lt;br /&gt;
StrTr( &amp;lt;str&amp;gt;, &amp;lt;replace_pairs&amp;gt; )&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Description ===&lt;br /&gt;
&lt;br /&gt;
If given three arguments, this function returns a copy of str 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.&lt;br /&gt;
&lt;br /&gt;
If from and to have different lengths, the extra characters in the longer of the two are ignored. The length of str will be the same as the return value's.&lt;br /&gt;
&lt;br /&gt;
If given two arguments, the second should be an array in the form array('from' =&amp;gt; 'to', ...). The return value is a string where all the occurrences of the array keys have been replaced by the corresponding values. The longest keys will be tried first. Once a substring has been replaced, its new value will not be searched again.&lt;br /&gt;
&lt;br /&gt;
In this case, the keys and the values may have any length, provided that there is no empty key; additionally, the length of the return value may differ from that of str. However, this function will be the most efficient when all the keys have the same size. &lt;br /&gt;
&lt;br /&gt;
=== Parameters ===&lt;br /&gt;
&lt;br /&gt;
==== str ====&lt;br /&gt;
&lt;br /&gt;
The string being translated.&lt;br /&gt;
&lt;br /&gt;
==== from ====&lt;br /&gt;
&lt;br /&gt;
The string being translated to to. &lt;br /&gt;
&lt;br /&gt;
==== to ====&lt;br /&gt;
&lt;br /&gt;
The string replacing from.&lt;br /&gt;
&lt;br /&gt;
==== replace_pairs ====&lt;br /&gt;
&lt;br /&gt;
The replace_pairs parameter may be used instead of to and from, in which case it's an array in the form array('from' =&amp;gt; 'to', ...).&lt;br /&gt;
&lt;br /&gt;
=== Return Value ===&lt;br /&gt;
&lt;br /&gt;
Success: Returns the translated string.&lt;br /&gt;
&lt;br /&gt;
Failure: Returns NULL&lt;br /&gt;
&lt;br /&gt;
=== Remarks ===&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&lt;br /&gt;
Basic Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sputnik&amp;quot;&amp;gt;&lt;br /&gt;
say strtr(&amp;quot;Hilla Warld&amp;quot;,&amp;quot;ia&amp;quot;,&amp;quot;eo&amp;quot;);&lt;br /&gt;
// PRINTS&lt;br /&gt;
// Hello World&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace Pairs Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sputnik&amp;quot;&amp;gt;&lt;br /&gt;
$trans = array(&amp;quot;h&amp;quot; =&amp;gt; &amp;quot;-&amp;quot;, &amp;quot;hello&amp;quot; =&amp;gt; &amp;quot;hi&amp;quot;, &amp;quot;hi&amp;quot; =&amp;gt; &amp;quot;hello&amp;quot;);&lt;br /&gt;
say strtr(&amp;quot;hi all, I said hello&amp;quot;, $trans);&lt;br /&gt;
// PRINTS&lt;br /&gt;
// hello all, I said hi&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Core Function]]&lt;/div&gt;</summary>
		<author><name>UberFoX</name></author>	</entry>

	</feed>