Skip to content

Commit

Permalink
batString: safe-string-ready map_first_char
Browse files Browse the repository at this point in the history
  • Loading branch information
gasche committed Nov 14, 2017
1 parent bc10ba1 commit e733374
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/batString.mlv
Original file line number Diff line number Diff line change
Expand Up @@ -931,10 +931,10 @@ let numeric_compare s1 s2 =
*)

##V<4.3##let map_first_char f s =
##V<4.3## let r = copy s in
##V<4.3## if length s > 0 then
##V<4.3## unsafe_set r 0 (f(unsafe_get s 0));
##V<4.3## r
##V<4.3## let r = Bytes.of_string s in
##V<4.3## if Bytes.length r > 0 then
##V<4.3## Bytes.unsafe_set r 0 (f (unsafe_get s 0));
##V<4.3## Bytes.unsafe_to_string r

##V<4.3##let capitalize_ascii s = map_first_char BatChar.uppercase_ascii s
##V<4.3##let uncapitalize_ascii s = map_first_char BatChar.lowercase_ascii s
Expand Down

0 comments on commit e733374

Please sign in to comment.