File: dbf\string_tools.ads

    1 --::::::::::
    2 --stritool.ads
    3 --::::::::::
    4 -- Developed by (C) Wasiliy W. Molostoff 1994, 1995.
    5 --                  Moscow, Russia,
    6 --                  Voice:   7 (095) 398-23-38
    7 --                  e-mail:  edv@edv.msk.ru
    8 -- This is free software; you can  freely  redistribute  it  and/or
    9 -- modify  it  without any restrictions.  Please report any errors.
   10 -- All corrections will be made as soon as possible.
   11 with  array_handler;
   12 with  boolean_set;
   13 package string_tools is
   14 
   15      package string_handler is new array_handler (character, string, 256, "txt");
   16      subtype string_object  is string_handler.object;
   17 
   18      generic
   19           with function argument (n: natural) return string;
   20           separator: in character := '%';
   21      procedure format (fmt: string; buf: in out string_object);
   22 
   23      package charsets is new boolean_set (character);
   24      use charsets;
   25 
   26      subtype charset is charsets.boolset;
   27 
   28      function value is new charsets.array_import (positive, string);
   29      package string_charsets is new charsets.import_set (string);
   30 
   31      function spaces   return charset;
   32      function numbers  return charset;
   33      function lowers   return charset;
   34      function uppers   return charset;
   35      function controls return charset;
   36      function specials return charset;
   37 
   38      function locate (frag:     charset;
   39                       within:   string_object;
   40                       from:     positive := 1;
   41                       to:       positive := positive'last) return natural;
   42 
   43      type translation is array (character) of character;
   44 
   45      function upper_case return translation;
   46      function lower_case return translation;
   47      function flip_case return translation;
   48      function same_case return translation;
   49 
   50      function  translate (item: string; tab: translation) return string;
   51      procedure translate (item: in out string; tab: translation);
   52 
   53      function  translate is new
   54      string_handler.translating_poly_in (translation, string, translate);
   55 
   56      procedure translate is new
   57      string_handler.transforming_poly_in_out (translation, translate);
   58 
   59 end;
   60