Merge pull request #6145 from roc-lang/improve-str-docs

Fix Str.walkUtf8 docs
This commit is contained in:
Richard Feldman 2023-12-01 21:53:12 -05:00 committed by GitHub
commit a557957415
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -880,8 +880,11 @@ walkUtf8WithIndexHelp = \string, state, step, index, length ->
## state for each byte.
##
## ```
## result = walkUtf8 "hello, world!" "" (\state, byte -> state ++ String.fromCodePoint byte)
## expect result == Ok "hello, world!"
## sumOfUtf8Bytes =
## Str.walkUtf8 "Hello, World!" 0 \total, byte ->
## total + byte
##
## expect sumOfUtf8Bytes == 105
## ```
walkUtf8 : Str, state, (state, U8 -> state) -> state
walkUtf8 = \str, initial, step ->