%=====================================================================================================================================
% Package akkstring by Igor Akkerman (c) 2004, 2005
% Package providing string operation utilities.
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License (latest version).
%
% The latest version of this license can be found at
%     http://www.latex-project.org/lppl.txt
%
% This file may only be distributed together with the full 'AkkTeX' bundle.
%=====================================================================================================================================
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesPackage{akkstring}[2005/04/30 1.2.2 by Igor Akkerman (c) 2004, 2005 Package providing string operation utilities.]
%=====================================================================================================================================

\RequirePackage{ifthen}

\makeatletter

\newcommand \ignore[1] {}
\newcommand \ign[1]    {}

\newcommand \centerln[1] {\hspace*{\fill}{#1}\hspace*{\fill}}

\newcommand \firstchar[1] {%
    \def\@firstof##1##2!!!{##1}%
    \expandafter\@firstof#1!!!%
}

\newcommand \removefirstchar[1] {%
    \def\@restof##1##2!!!{##2}%
    \expandafter\@restof#1!!!%
}

% \extractleadingnumber {<string>} {<countername>}
\newcommand \extractleadingnumber[2] {%
    \setbox0=\hbox{\global\csname c@#2\endcsname 0#1\relax}%
}

% \extractnumber {<string>} {<countername>}
\newcommand \extractnumber[2] {%
    \def\@restof##1##2!!!{##2}%
    \def\@remblank##1##2!!!{##1##2}%
    \edef\@string{#1}%
    \extractleadingnumber\@string{#2}%
    \whiledo{\(\not \equal{\@string}{}\) \and \value{#2} = 0} {%
        \edef\@string{\expandafter\@restof\@string!!!}%
        \edef\@string{\expandafter\@remblank\@string!!!}%
        \extractleadingnumber\@string{#2}%
    }%
}

\makeatother
