Repeat a string: Difference between revisions
m
→{{header|Visual Basic}}: Suppress space
PatGarrett (talk | contribs) (→{{header|Visual Basic}}: a correction) |
PatGarrett (talk | contribs) m (→{{header|Visual Basic}}: Suppress space) |
||
Line 2,196:
An alternative method:
<lang vb>Public Function StrRepeat(sText As String, n As Integer) As String▼
▲Public Function StrRepeat(sText As String, n As Integer) As String
StrRepeat = Replace(String(n, "*"), "*", sText)
End Function</lang>
<br>'''Repeat a character'''<br>
<lang VBA>Debug.Print String(5, "x")</lang>
{{out}}
<pre>xxxxx</pre>
|