2013-04-10 23:57:08 -07:00
|
|
|
let string_repeat s n =
|
2015-11-18 06:14:39 +00:00
|
|
|
let len = Bytes.length s in
|
|
|
|
|
let res = Bytes.create(n * len) in
|
2013-04-10 23:57:08 -07:00
|
|
|
for i = 0 to pred n do
|
2015-11-18 06:14:39 +00:00
|
|
|
Bytes.blit s 0 res (i * len) len
|
2013-04-10 23:57:08 -07:00
|
|
|
done;
|
2015-11-18 06:14:39 +00:00
|
|
|
Bytes.to_string res (* not stricly necessary, the bytes type is equivalent to string except mutability *)
|
2013-04-10 23:57:08 -07:00
|
|
|
;;
|