Repeat a string: Difference between revisions
Content deleted Content added
No edit summary |
→{{header|NetRexx}}: Demonstrate other functions |
||
Line 708: | Line 708: | ||
ha5 = 'ha'.copies(5) |
ha5 = 'ha'.copies(5) |
||
</lang> |
</lang> |
||
There are several other built-in functions that can be used to achieve the same result depending on need: |
|||
<lang NetRexx>/* NetRexx */ |
|||
sampleStr = 'ha' -- string to duplicate |
|||
say ' COPIES:' sampleStr.copies(5) |
|||
say 'CHANGESTR:' '.....'.changestr('.', sampleStr) |
|||
sampleChr = '*' -- character to duplicate |
|||
say ' LEFT:' sampleChr.left(5, sampleChr) |
|||
say ' RIGHT:' sampleChr.right(5, sampleChr) |
|||
say ' CENTRE:' sampleChr.centre(5, sampleChr) |
|||
say ' SUBSTR:' ''.substr(1, 5, sampleChr) |
|||
say 'TRANSLATE:' '.....'.translate(sampleChr, '.') |
|||
say ' OVERLAY:' sampleChr.overlay(sampleChr, 1, 5, sampleChr) |
|||
</lang> |
|||
=={{header|Objeck}}== |
=={{header|Objeck}}== |
||
<lang objeck>bundle Default { |
<lang objeck>bundle Default { |