Data update
This commit is contained in:
parent
4bb20c9b71
commit
cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions
11
Task/Reverse-a-string/ReScript/reverse-a-string.res
Normal file
11
Task/Reverse-a-string/ReScript/reverse-a-string.res
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
let rev_string = (s) => {
|
||||
let len = Js.String2.length(s)
|
||||
let arr = []
|
||||
for i in 0 to (len-1) {
|
||||
let c = Js.String2.get(s, len - 1 - i)
|
||||
let _ = Js.Array2.push(arr, c)
|
||||
}
|
||||
Js.String2.concatMany("", arr)
|
||||
}
|
||||
|
||||
Js.log(rev_string("abcdefg"))
|
||||
Loading…
Add table
Add a link
Reference in a new issue