Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
11
Task/Reverse-a-string/ReScript/reverse-a-string.re
Normal file
11
Task/Reverse-a-string/ReScript/reverse-a-string.re
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