September Morn Update

This commit is contained in:
Ingy döt Net 2019-09-12 10:33:56 -07:00
parent 4e2d22a71d
commit aac6731f2c
6856 changed files with 141342 additions and 21127 deletions

View file

@ -0,0 +1,3 @@
report z_repeat_string.
write repeat( val = `ha` occ = 5 ).

View file

@ -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())
}

View file

@ -0,0 +1 @@
strUtils.dupeString('ha', 5)

View file

@ -0,0 +1 @@
stringOfChar('*', 5)

View file

@ -0,0 +1 @@
space(5)

View 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")

View file

@ -1,2 +1,2 @@
import strutils
repeatStr(5, "ha")
repeat("ha", 5)

View file

@ -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: */

View 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);
}

View file

@ -1 +1 @@
paste(rep("ha",5), collapse='')
strrep("ha", 5)

View file

@ -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)

View file

@ -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

View file

@ -0,0 +1 @@
Debug.Print String(5, "x")

View file

@ -1 +1 @@
FileContents = "".PadRight(FileSizeBytes, "X")
Debug.Print(Replace(Space(5), " ", "Ha"))

View file

@ -1 +1,3 @@
FileContents = "".PadRight(3, "XO-")
Debug.Print(StrDup(5, "x"))
Debug.Print("".PadRight(5, "x"))
Debug.Print("".PadLeft(5, "x"))

View 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)

View file

@ -0,0 +1,3 @@
Public Function StrRepeat(sText As String, n As Integer) As String
StrRepeat = Replace(String(n, "*"), "*", sText)
End Function

View file

@ -0,0 +1 @@
Debug.Print String(5, "x")