Jump to content

Repeat a string: Difference between revisions

m
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
<lang vb>
Public Function StrRepeat(sText As String, n As Integer) As String
StrRepeat = Replace(String(n, "*"), "*", sText)
End Function</lang>
</lang>
 
<br>'''Repeat a character'''<br>
<lang VBA>Debug.Print String(5, "x")</lang>
Debug.Print String(5, "x")
</lang>
{{out}}
<pre>xxxxx</pre>
1,392

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.