September Morn Update
This commit is contained in:
parent
4e2d22a71d
commit
aac6731f2c
6856 changed files with 141342 additions and 21127 deletions
3
Task/Repeat-a-string/ABAP/repeat-a-string.abap
Normal file
3
Task/Repeat-a-string/ABAP/repeat-a-string.abap
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
report z_repeat_string.
|
||||
|
||||
write repeat( val = `ha` occ = 5 ).
|
||||
|
|
@ -1,7 +1,8 @@
|
|||
import system'routines.
|
||||
import extensions.
|
||||
import system'routines;
|
||||
import extensions;
|
||||
import extensions'text;
|
||||
|
||||
program =
|
||||
[
|
||||
var s := 0 till:5 repeat(:n)( "ha" ); summarize(String new); literal.
|
||||
].
|
||||
public program()
|
||||
{
|
||||
var s := new Range(0, 5).selectBy:(x => "ha").summarize(new StringWriter())
|
||||
}
|
||||
|
|
|
|||
1
Task/Repeat-a-string/Free-Pascal/repeat-a-string-1.free
Normal file
1
Task/Repeat-a-string/Free-Pascal/repeat-a-string-1.free
Normal file
|
|
@ -0,0 +1 @@
|
|||
strUtils.dupeString('ha', 5)
|
||||
1
Task/Repeat-a-string/Free-Pascal/repeat-a-string-2.free
Normal file
1
Task/Repeat-a-string/Free-Pascal/repeat-a-string-2.free
Normal file
|
|
@ -0,0 +1 @@
|
|||
stringOfChar('*', 5)
|
||||
1
Task/Repeat-a-string/Free-Pascal/repeat-a-string-3.free
Normal file
1
Task/Repeat-a-string/Free-Pascal/repeat-a-string-3.free
Normal file
|
|
@ -0,0 +1 @@
|
|||
space(5)
|
||||
11
Task/Repeat-a-string/Neko/repeat-a-string.neko
Normal file
11
Task/Repeat-a-string/Neko/repeat-a-string.neko
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
/* Repeat a string, in Neko */
|
||||
var srep = function(s, n) {
|
||||
var str = ""
|
||||
while n > 0 {
|
||||
str += s
|
||||
n -= 1
|
||||
}
|
||||
return str
|
||||
}
|
||||
|
||||
$print(srep("ha", 5), "\n")
|
||||
|
|
@ -1,2 +1,2 @@
|
|||
import strutils
|
||||
repeatStr(5, "ha")
|
||||
repeat("ha", 5)
|
||||
|
|
|
|||
|
|
@ -1,3 +1,9 @@
|
|||
/* To repeat a string a variable number of times: */
|
||||
|
||||
s = repeat('ha', 4);
|
||||
|
||||
/* or */
|
||||
|
||||
s = copy('ha', 5);
|
||||
|
||||
/* To repeat a single character a fixed number of times: */
|
||||
|
|
|
|||
10
Task/Repeat-a-string/Processing/repeat-a-string
Normal file
10
Task/Repeat-a-string/Processing/repeat-a-string
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
void setup() {
|
||||
String rep = repeat("ha", 5);
|
||||
println(rep);
|
||||
}
|
||||
String repeat(String str, int times) {
|
||||
// make an array of n chars,
|
||||
// replace each char with str,
|
||||
// and return as a new String
|
||||
return new String(new char[times]).replace("\0", str);
|
||||
}
|
||||
|
|
@ -1 +1 @@
|
|||
paste(rep("ha",5), collapse='')
|
||||
strrep("ha", 5)
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
Public Function RepeatStr(aString As String, aNumber As Integer) As String
|
||||
Dim bString As String
|
||||
|
||||
bString = aString
|
||||
If aNumber > 1 Then
|
||||
For i = 2 To aNumber
|
||||
bString = bString & aString
|
||||
Next i
|
||||
End If
|
||||
RepeatStr = bString
|
||||
Dim bString As String, i As Integer
|
||||
bString = ""
|
||||
For i = 1 To aNumber
|
||||
bString = bString & aString
|
||||
Next i
|
||||
RepeatStr = bString
|
||||
End Function
|
||||
|
||||
Debug.Print RepeatStr("ha", 5)
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
Public Function RepeatString(stText As String, iQty As Integer) As String
|
||||
RepeatString = Replace(String(iQty, "x"), "x", stText)
|
||||
RepeatString = Replace(String(iQty, "x"), "x", stText)
|
||||
End Function
|
||||
|
|
|
|||
1
Task/Repeat-a-string/VBA/repeat-a-string-3.vba
Normal file
1
Task/Repeat-a-string/VBA/repeat-a-string-3.vba
Normal file
|
|
@ -0,0 +1 @@
|
|||
Debug.Print String(5, "x")
|
||||
|
|
@ -1 +1 @@
|
|||
FileContents = "".PadRight(FileSizeBytes, "X")
|
||||
Debug.Print(Replace(Space(5), " ", "Ha"))
|
||||
|
|
|
|||
|
|
@ -1 +1,3 @@
|
|||
FileContents = "".PadRight(3, "XO-")
|
||||
Debug.Print(StrDup(5, "x"))
|
||||
Debug.Print("".PadRight(5, "x"))
|
||||
Debug.Print("".PadLeft(5, "x"))
|
||||
|
|
|
|||
10
Task/Repeat-a-string/Visual-Basic/repeat-a-string-1.vb
Normal file
10
Task/Repeat-a-string/Visual-Basic/repeat-a-string-1.vb
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
Public Function StrRepeat(s As String, n As Integer) As String
|
||||
Dim r As String, i As Integer
|
||||
r = ""
|
||||
For i = 1 To n
|
||||
r = r & s
|
||||
Next i
|
||||
StrRepeat = r
|
||||
End Function
|
||||
|
||||
Debug.Print StrRepeat("ha", 5)
|
||||
3
Task/Repeat-a-string/Visual-Basic/repeat-a-string-2.vb
Normal file
3
Task/Repeat-a-string/Visual-Basic/repeat-a-string-2.vb
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
Public Function StrRepeat(sText As String, n As Integer) As String
|
||||
StrRepeat = Replace(String(n, "*"), "*", sText)
|
||||
End Function
|
||||
1
Task/Repeat-a-string/Visual-Basic/repeat-a-string-3.vb
Normal file
1
Task/Repeat-a-string/Visual-Basic/repeat-a-string-3.vb
Normal file
|
|
@ -0,0 +1 @@
|
|||
Debug.Print String(5, "x")
|
||||
Loading…
Add table
Add a link
Reference in a new issue