September Morn Update
This commit is contained in:
parent
4e2d22a71d
commit
aac6731f2c
6856 changed files with 141342 additions and 21127 deletions
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);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue