-
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathutils.v
More file actions
35 lines (31 loc) · 581 Bytes
/
utils.v
File metadata and controls
35 lines (31 loc) · 581 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
module boxx
import thecodrr.crayon
import strings
fn repeat(c string, n int) string {
if n <= 0{
return ''
}
mut builder := strings.new_builder(n)
for i := 0; i < n; i++{
builder.write_string(c)
}
str := builder.str()
//builder.free()
return str
}
fn repeat_with_string(c string, n int, str string) string {
count := n - str.len - 2
bar := repeat(c, count)
str1 := ' $str $bar'
return str1
}
fn max(arr []string) int {
mut last_len := 0
for _, key in arr {
len := crayon.strip_text(key).len
if len > last_len {
last_len = len
}
}
return last_len
}