dib: Move 'isdigit' utility function to common code.

No change, just simple refactoring.
This commit is contained in:
Richard W.M. Jones
2015-09-07 16:53:17 +01:00
parent 4ded4430bf
commit 4335088d74
3 changed files with 6 additions and 3 deletions

View File

@@ -76,9 +76,6 @@ let digit_prefix_compare a b =
let split_prefix str =
let len = String.length str in
let digits =
let isdigit = function
| '0'..'9' -> true
| _ -> false in
try string_index_fn (fun x -> not (isdigit x)) str
with Not_found -> len in
match digits with

View File

@@ -58,6 +58,10 @@ let le32_of_int i =
String.unsafe_set s 3 (Char.unsafe_chr (Int64.to_int c3));
s
let isdigit = function
| '0'..'9' -> true
| _ -> false
type wrap_break_t = WrapEOS | WrapSpace | WrapNL
let rec wrap ?(chan = stdout) ?(indent = 0) str =

View File

@@ -32,6 +32,8 @@ val div_roundup64 : int64 -> int64 -> int64
val int_of_le32 : string -> int64
val le32_of_int : int64 -> string
val isdigit : char -> bool
val wrap : ?chan:out_channel -> ?indent:int -> string -> unit
(** Wrap text. *)