(* Character utility routines for ocaml
Copyright (C) 2002 Shawn Wagner <raevnos@pennmush.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*)
(** Utility functions for dealing with characters *)
(** {1 Locale} *)
(** Set the CTYPE locale. *)
val set_chartype : string -> string option
(** Query the CTYPE locale being used. *)
val get_chartype : unit -> string
(** {1 Character classification } *)
(** The following functions test characters for certain
properties. Wrappers for the C <ctype.h> header. *)
(** Is the character alphabetic? *)
external is_alpha : char -> bool = "stew_is_alpha"
(** Is the character whitespace? *)
external is_space : char -> bool = "stew_is_space"
(** Is the character a digit? *)
external is_number : char -> bool = "stew_is_number"
(** Is the character lowercase? *)
external is_lower : char -> bool = "stew_is_lower"
(** Is the character uppercase? *)
external is_upper : char -> bool = "stew_is_upper"
(** Is the character alphabetic or a digit? *)
val is_alphanumeric : char -> bool
(** Is the character a punctuation symbol? *)
external is_punctation : char -> bool = "stew_is_punct"
(** Is the character displayable? *)
external is_printable : char -> bool = "stew_is_print"
(** Is the character displayable and not whitespace? *)
external is_graphical : char -> bool = "stew_is_graph"
(** Is the character a digit in base 16? *)
external is_hexadecimal : char -> bool = "stew_is_xdigit"
(** {1 Character transformation} *)
(** Lowercase the character according to the CTYPE locale. *)
external to_lower : char -> char = "stew_to_lower"
(** Uppercase the character according to the CTYPE locale. *)
external to_upper : char -> char = "stew_to_upper"