Copy a string: Difference between revisions
Content added Content deleted
Drkameleon (talk | contribs) (added Arturo) |
m (→{{header|Phix}}: added syntax colouring the hard way, phix/basics) |
||
Line 1,709: | Line 1,709: | ||
=={{header|Phix}}== |
=={{header|Phix}}== |
||
{{libheader|Phix/basics}} |
|||
Use of strings is utterly intuitive with no unexpected side effects. For example |
Use of strings is utterly intuitive with no unexpected side effects. For example |
||
<lang Phix> |
<!--<lang Phix>--> |
||
<span style="color: #004080;">string</span> <span style="color: #000000;">one</span> <span style="color: #0000FF;">=</span> <span style="color: #008000;">"feed"</span> |
|||
string that = this -- (that becomes "feed", this remains "feed") |
|||
<span style="color: #004080;">string</span> <span style="color: #000000;">two</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">one</span> <span style="color: #000080;font-style:italic;">-- (two becomes "feed", one remains "feed")</span> |
|||
that[2..3] = "oo" -- (that becomes "food", this remains "feed") |
|||
<span style="color: #000000;">two<span style="color: #0000FF;">[<span style="color: #000000;">2<span style="color: #0000FF;">..<span style="color: #000000;">3<span style="color: #0000FF;">]</span> <span style="color: #0000FF;">=</span> <span style="color: #008000;">"oo"</span> <span style="color: #000080;font-style:italic;">-- (two becomes "food", one remains "feed")</span> |
|||
this[1] = 'n' -- (that remains "food", this becomes "need") |
|||
<span style="color: #000000;">one<span style="color: #0000FF;">[<span style="color: #000000;">1<span style="color: #0000FF;">]</span> <span style="color: #0000FF;">=</span> <span style="color: #008000;">'n'</span> <span style="color: #000080;font-style:italic;">-- (two remains "food", one becomes "need")</span> |
|||
?{this,that} |
|||
<span style="color: #0000FF;">?<span style="color: #0000FF;">{<span style="color: #000000;">one<span style="color: #0000FF;">,<span style="color: #000000;">two<span style="color: #0000FF;">} |
|||
</lang> |
<!--</lang>--> |
||
{{out}} |
{{out}} |
||
<pre> |
<pre> |