\section{KString\-Handler Class Reference}
\label{classKStringHandler}\index{KStringHandler@{KStringHandler}}
This class contains utility functions for handling strings. Class for manipulating words and sentences in strings.  


{\tt \#include $<$kstringhandler.h$>$}

\subsection*{Static Public Member Functions}
\begin{CompactItemize}
\item 
static {\bf QString} {\bf word} (const {\bf QString} \&text, uint pos) KDE\_\-DEPRECATED
\item 
static {\bf QString} {\bf word} (const {\bf QString} \&text, const char $\ast$range)
\item 
static {\bf QString} {\bf insword} (const {\bf QString} \&text, const {\bf QString} \&word, uint pos)
\item 
static {\bf QString} {\bf setword} (const {\bf QString} \&text, const {\bf QString} \&word, uint pos)
\item 
static {\bf QString} {\bf remrange} (const {\bf QString} \&text, const char $\ast$range)
\item 
static {\bf QString} {\bf remword} (const {\bf QString} \&text, uint pos)
\item 
static {\bf QString} {\bf remword} (const {\bf QString} \&text, const {\bf QString} \&word)
\item 
static {\bf QString} {\bf capwords} (const {\bf QString} \&text)
\item 
static {\bf QString\-List} {\bf capwords} (const {\bf QString\-List} \&list)
\item 
static {\bf QString} {\bf reverse} (const {\bf QString} \&text)
\item 
static {\bf QString\-List} {\bf reverse} (const {\bf QString\-List} \&list)
\item 
static {\bf QString} {\bf ljust} (const {\bf QString} \&text, uint width) KDE\_\-DEPRECATED
\item 
static {\bf QString} {\bf rjust} (const {\bf QString} \&text, uint width) KDE\_\-DEPRECATED
\item 
static {\bf QString} {\bf center} (const {\bf QString} \&text, uint width)
\item 
static {\bf QString} {\bf lsqueeze} (const {\bf QString} \&str, uint maxlen=40)
\item 
static {\bf QString} {\bf l\-Em\-Squeeze} (const {\bf QString} \&name, const {\bf QFont\-Metrics} \&font\-Metrics, uint maxlen=30)
\item 
static {\bf QString} {\bf l\-Pixel\-Squeeze} (const {\bf QString} \&name, const {\bf QFont\-Metrics} \&font\-Metrics, uint max\-Pixels)
\item 
static {\bf QString} {\bf csqueeze} (const {\bf QString} \&str, uint maxlen=40)
\item 
static {\bf QString} {\bf c\-Em\-Squeeze} (const {\bf QString} \&name, const {\bf QFont\-Metrics} \&font\-Metrics, uint maxlen=30)
\item 
static {\bf QString} {\bf c\-Pixel\-Squeeze} (const {\bf QString} \&name, const {\bf QFont\-Metrics} \&font\-Metrics, uint max\-Pixels)
\item 
static {\bf QString} {\bf rsqueeze} (const {\bf QString} \&str, uint maxlen=40)
\item 
static {\bf QString} {\bf r\-Em\-Squeeze} (const {\bf QString} \&name, const {\bf QFont\-Metrics} \&font\-Metrics, uint maxlen=30)
\item 
static {\bf QString} {\bf r\-Pixel\-Squeeze} (const {\bf QString} \&name, const {\bf QFont\-Metrics} \&font\-Metrics, uint max\-Pixels)
\item 
static bool {\bf match\-File\-Name} (const {\bf QString} \&filename, const {\bf QString} \&pattern)
\item 
static {\bf QString\-List} {\bf perl\-Split} (const {\bf QString} \&sep, const {\bf QString} \&s, uint max=0)
\item 
static {\bf QString\-List} {\bf perl\-Split} (const {\bf QChar} \&sep, const {\bf QString} \&s, uint max=0)
\item 
static {\bf QString\-List} {\bf perl\-Split} (const {\bf QReg\-Exp} \&sep, const {\bf QString} \&s, uint max=0)
\item 
static {\bf QString} {\bf tag\-URLs} (const {\bf QString} \&text)
\item 
static {\bf QString} {\bf obscure} (const {\bf QString} \&str)
\item 
static bool {\bf is\-Utf8} (const char $\ast$str)
\item 
static {\bf QString} {\bf from8Bit} (const char $\ast$str)
\item 
static KDE\_\-DEPRECATED bool {\bf match\-Filename} (const {\bf QString} \&filename, const {\bf QString} \&pattern)
\end{CompactItemize}


\subsection{Detailed Description}
This class contains utility functions for handling strings. Class for manipulating words and sentences in strings. 

This class is {\em not\/} a substitute for the {\bf QString} class. What I tried to do with this class is provide an easy way to cut/slice/splice words inside sentences in whatever order desired. While the main focus of this class are words (ie characters separated by spaces/tabs), the two core functions here ( split() and join() ) will function given any char to use as a separator. This will make it easy to redefine what a 'word' means in the future if needed.

I freely stole some of the function names from python. I also think some of these were influenced by m\-IRC (yes, believe it if you will, I used to write a LOT of scripts in m\-IRC).

The ranges are a fairly powerful way of getting/stripping words from a string. These ranges function, for the large part, as they would in python. See the word(const QString\&, int) and remword(const QString\&, int) functions for more detail.

This class contains no data members of it own. All strings are cut on the fly and returned as new qstrings/qstringlists.

Quick example on how to use:



\footnotesize\begin{verbatim} KStringHandler kstr;
 QString line = "This is a test of the strings";

 cout << "1> " << kstr.word( line , "4:" ) << "\n";
 cout << "2> " << kstr.remrange( line , "2:5" ) << "\n";
 cout << "2> " << kstr.reverse( line ) << "\n";
 cout << "2> " << kstr.center( kstr.word( line , 4 ) , 15 ) << "\n";
\end{verbatim}
\normalsize


and so forth.

\begin{Desc}
\item[Author:]Ian Zepp $<${\tt icszepp@islc.net}$>$ \end{Desc}
\begin{Desc}
\item[See also:]{\bf KShell}{\rm (p.\,\pageref{namespaceKShell})} \end{Desc}




Definition at line 70 of file kstringhandler.h.

\subsection{Member Function Documentation}
\index{KStringHandler@{KString\-Handler}!word@{word}}
\index{word@{word}!KStringHandler@{KString\-Handler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KString\-Handler::word (const {\bf QString} \& {\em text}, uint {\em pos})\hspace{0.3cm}{\tt  [static]}}\label{classKStringHandler_e0}


Returns the nth word in the string if found Returns a EMPTY (not null) string otherwise. 

Note that the FIRST index is 0. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em text}]the string to search for the words \item[{\em pos}]the position of the word to search \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the word, or an empty string if not found \end{Desc}
\begin{Desc}
\item[{\bf Deprecated}]use {\bf QString::section} instead \end{Desc}


Definition at line 43 of file kstringhandler.cpp.

References QString::section().

Referenced by insword(), remword(), and setword().\index{KStringHandler@{KString\-Handler}!word@{word}}
\index{word@{word}!KStringHandler@{KString\-Handler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KString\-Handler::word (const {\bf QString} \& {\em text}, const char $\ast$ {\em range})\hspace{0.3cm}{\tt  [static]}}\label{classKStringHandler_e1}


Returns a range of words from that string. 

Ie: \begin{itemize}
\item \char`\"{}0\char`\"{} returns the very first word \item \char`\"{}0:\char`\"{} returns the first to the last word \item \char`\"{}0:3\char`\"{} returns the first to fourth words \item \char`\"{}:3\char`\"{} returns everything up to the fourth word\end{itemize}
If you grok python, you're set. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em text}]the string to search for the words \item[{\em range}]the words to return (see description) \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the words, or an empty string if not found \end{Desc}


Definition at line 48 of file kstringhandler.cpp.

References QString\-List::split(), and QString::strip\-White\-Space().\index{KStringHandler@{KString\-Handler}!insword@{insword}}
\index{insword@{insword}!KStringHandler@{KString\-Handler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KString\-Handler::insword (const {\bf QString} \& {\em text}, const {\bf QString} \& {\em word}, uint {\em pos})\hspace{0.3cm}{\tt  [static]}}\label{classKStringHandler_e2}


Inserts a word into the string, and returns a new string with the word included. 

the first index is zero (0). If there are not {\tt pos} words in the original string, the new word will be appended to the end. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em text}]the original text \item[{\em word}]the word to insert \item[{\em pos}]the position (in words) for the new word \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the resulting string \end{Desc}


Definition at line 84 of file kstringhandler.cpp.

References QString::is\-Empty(), QString\-List::join(), QString\-List::split(), and word().\index{KStringHandler@{KString\-Handler}!setword@{setword}}
\index{setword@{setword}!KStringHandler@{KString\-Handler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KString\-Handler::setword (const {\bf QString} \& {\em text}, const {\bf QString} \& {\em word}, uint {\em pos})\hspace{0.3cm}{\tt  [static]}}\label{classKStringHandler_e3}


Replaces a word in the string, and returns a new string with the word included. 

the first index is zero (0). If there are not {\tt pos} words in the original string, the new word will be appended to the end. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em text}]the original text \item[{\em word}]the word to insert \item[{\em pos}]the position (in words) for the new word \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the resulting string \end{Desc}


Definition at line 104 of file kstringhandler.cpp.

References QString::is\-Empty(), QString\-List::join(), QString\-List::split(), and word().\index{KStringHandler@{KString\-Handler}!remrange@{remrange}}
\index{remrange@{remrange}!KStringHandler@{KString\-Handler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KString\-Handler::remrange (const {\bf QString} \& {\em text}, const char $\ast$ {\em range})\hspace{0.3cm}{\tt  [static]}}\label{classKStringHandler_e4}


Removes a word or ranges of words from the string, and returns a new string. 

The ranges definitions follow the definitions for the {\bf word()}{\rm (p.\,\pageref{classKStringHandler_e0})} function.

\begin{itemize}
\item \char`\"{}0\char`\"{} removes the very first word \item \char`\"{}0:\char`\"{} removes the first the the last word \item \char`\"{}0:3\char`\"{} removes the first to fourth words \item \char`\"{}:3\char`\"{} removes everything up to the fourth word \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em text}]the original text \item[{\em range}]the words to remove (see description) \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the resulting string \end{Desc}
\end{itemize}


Definition at line 126 of file kstringhandler.cpp.

References QString\-List::join(), and QString\-List::split().\index{KStringHandler@{KString\-Handler}!remword@{remword}}
\index{remword@{remword}!KStringHandler@{KString\-Handler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KString\-Handler::remword (const {\bf QString} \& {\em text}, uint {\em pos})\hspace{0.3cm}{\tt  [static]}}\label{classKStringHandler_e5}


Removes a word at the given index, and returns a new string. 

The first index is zero (0). \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em text}]the original text \item[{\em pos}]the position (in words) of thw word to delete \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the resulting string \end{Desc}


Definition at line 155 of file kstringhandler.cpp.

References QString\-List::join(), and QString\-List::split().\index{KStringHandler@{KString\-Handler}!remword@{remword}}
\index{remword@{remword}!KStringHandler@{KString\-Handler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KString\-Handler::remword (const {\bf QString} \& {\em text}, const {\bf QString} \& {\em word})\hspace{0.3cm}{\tt  [static]}}\label{classKStringHandler_e6}


Removes a matching word from the string, and returns a new string. 

Note that only ONE match is removed. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em text}]the original text \item[{\em word}]the word to remove \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the resulting string \end{Desc}


Definition at line 172 of file kstringhandler.cpp.

References QString::is\-Empty(), QString\-List::join(), QString\-List::split(), and word().\index{KStringHandler@{KString\-Handler}!capwords@{capwords}}
\index{capwords@{capwords}!KStringHandler@{KString\-Handler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KString\-Handler::capwords (const {\bf QString} \& {\em text})\hspace{0.3cm}{\tt  [static]}}\label{classKStringHandler_e7}


Capitalizes each word in the string \char`\"{}hello there\char`\"{} becomes \char`\"{}Hello There\char`\"{} (string). 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em text}]the text to capitalize \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the resulting string \end{Desc}


Definition at line 197 of file kstringhandler.cpp.

References QString\-List::join(), QString::replace(), and QString::strip\-White\-Space().\index{KStringHandler@{KString\-Handler}!capwords@{capwords}}
\index{capwords@{capwords}!KStringHandler@{KString\-Handler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString\-List} KString\-Handler::capwords (const {\bf QString\-List} \& {\em list})\hspace{0.3cm}{\tt  [static]}}\label{classKStringHandler_e8}


Capitalizes each word in the list [hello, there] becomes [Hello, There] (list). 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em list}]the list to capitalize \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the resulting list \end{Desc}


Definition at line 211 of file kstringhandler.cpp.

References QString::mid(), and QString::upper().\index{KStringHandler@{KString\-Handler}!reverse@{reverse}}
\index{reverse@{reverse}!KStringHandler@{KString\-Handler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KString\-Handler::reverse (const {\bf QString} \& {\em text})\hspace{0.3cm}{\tt  [static]}}\label{classKStringHandler_e9}


Reverses the order of the words in a string \char`\"{}hello there\char`\"{} becomes \char`\"{}there hello\char`\"{} (string). 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em text}]the text to reverse \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the resulting string \end{Desc}


Definition at line 223 of file kstringhandler.cpp.

References QString\-List::join(), and QString\-List::split().\index{KStringHandler@{KString\-Handler}!reverse@{reverse}}
\index{reverse@{reverse}!KStringHandler@{KString\-Handler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString\-List} KString\-Handler::reverse (const {\bf QString\-List} \& {\em list})\hspace{0.3cm}{\tt  [static]}}\label{classKStringHandler_e10}


Reverses the order of the words in a list [hello, there] becomes [there, hello] (list). 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em list}]the list to reverse \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the resulting list \end{Desc}


Definition at line 237 of file kstringhandler.cpp.\index{KStringHandler@{KString\-Handler}!ljust@{ljust}}
\index{ljust@{ljust}!KStringHandler@{KString\-Handler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KString\-Handler::ljust (const {\bf QString} \& {\em text}, uint {\em width})\hspace{0.3cm}{\tt  [static]}}\label{classKStringHandler_e11}


Left-justifies a string and returns a string at least 'width' characters wide. 

If the string is longer than the {\tt width}, the original string is returned. It is never truncated. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em text}]the text to justify \item[{\em width}]the desired width of the new string \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the resulting string \end{Desc}
\begin{Desc}
\item[{\bf Deprecated}]use {\bf QString::left\-Justify} instead \end{Desc}


Definition at line 255 of file kstringhandler.cpp.

References QString::left\-Justify(), and QString::strip\-White\-Space().\index{KStringHandler@{KString\-Handler}!rjust@{rjust}}
\index{rjust@{rjust}!KStringHandler@{KString\-Handler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KString\-Handler::rjust (const {\bf QString} \& {\em text}, uint {\em width})\hspace{0.3cm}{\tt  [static]}}\label{classKStringHandler_e12}


Right-justifies a string and returns a string at least 'width' characters wide. 

If the string is longer than the {\tt width}, the original string is returned. It is never truncated. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em text}]the text to justify \item[{\em width}]the desired width of the new string \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the resulting string \end{Desc}
\begin{Desc}
\item[{\bf Deprecated}]use {\bf QString::right\-Justify} instead \end{Desc}


Definition at line 260 of file kstringhandler.cpp.

References QString::right\-Justify(), and QString::strip\-White\-Space().\index{KStringHandler@{KString\-Handler}!center@{center}}
\index{center@{center}!KStringHandler@{KString\-Handler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KString\-Handler::center (const {\bf QString} \& {\em text}, uint {\em width})\hspace{0.3cm}{\tt  [static]}}\label{classKStringHandler_e13}


Centers a string and returns a string at least 'width' characters wide. 

If the string is longer than the {\tt width}, the original string is returned. It is never truncated. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em text}]the text to justify \item[{\em width}]the desired width of the new string \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the resulting string \end{Desc}


Definition at line 265 of file kstringhandler.cpp.

References QString::fill(), QString::left\-Justify(), QString::length(), and QString::strip\-White\-Space().\index{KStringHandler@{KString\-Handler}!lsqueeze@{lsqueeze}}
\index{lsqueeze@{lsqueeze}!KStringHandler@{KString\-Handler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KString\-Handler::lsqueeze (const {\bf QString} \& {\em str}, uint {\em maxlen} = {\tt 40})\hspace{0.3cm}{\tt  [static]}}\label{classKStringHandler_e14}


Substitute characters at the beginning of a string by \char`\"{}...\char`\"{}. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em str}]is the string to modify \item[{\em maxlen}]is the maximum length the modified string will have If the original string is shorter than \char`\"{}maxlen\char`\"{}, it is returned verbatim \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the modified string \end{Desc}


Definition at line 280 of file kstringhandler.cpp.\index{KStringHandler@{KString\-Handler}!lEmSqueeze@{lEmSqueeze}}
\index{lEmSqueeze@{lEmSqueeze}!KStringHandler@{KString\-Handler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KString\-Handler::l\-Em\-Squeeze (const {\bf QString} \& {\em name}, const {\bf QFont\-Metrics} \& {\em font\-Metrics}, uint {\em maxlen} = {\tt 30})\hspace{0.3cm}{\tt  [static]}}\label{classKStringHandler_e15}


Substitute characters at the beginning of a string by \char`\"{}...\char`\"{}. 

Similar to method above, except that it truncates based on pixel width rather than the number of characters \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em name}]is the string to modify \item[{\em font\-Metrics}]is the font metrics to use to calculate character sizes \item[{\em maxlen}]is the maximum length in ems the modified string will have If the original string is shorter than \char`\"{}maxlen\char`\"{}, it is returned verbatim \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the modified string \end{Desc}
\begin{Desc}
\item[Since:]3.2 \end{Desc}


Definition at line 307 of file kstringhandler.cpp.

References l\-Pixel\-Squeeze().\index{KStringHandler@{KString\-Handler}!lPixelSqueeze@{lPixelSqueeze}}
\index{lPixelSqueeze@{lPixelSqueeze}!KStringHandler@{KString\-Handler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KString\-Handler::l\-Pixel\-Squeeze (const {\bf QString} \& {\em name}, const {\bf QFont\-Metrics} \& {\em font\-Metrics}, uint {\em max\-Pixels})\hspace{0.3cm}{\tt  [static]}}\label{classKStringHandler_e16}


Substitute characters at the beginning of a string by \char`\"{}...\char`\"{}. 

Similar to method above, except that maxlen is the width in pixels to truncate to \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em name}]is the string to modify \item[{\em font\-Metrics}]is the font metrics to use to calculate character sizes \item[{\em max\-Pixels}]is the maximum pixel length the modified string will have If the original string is shorter than \char`\"{}maxlen\char`\"{}, it is returned verbatim \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the modified string \end{Desc}
\begin{Desc}
\item[Since:]3.2 \end{Desc}


Definition at line 312 of file kstringhandler.cpp.

References QString::is\-Empty(), and QString::remove().

Referenced by l\-Em\-Squeeze().\index{KStringHandler@{KString\-Handler}!csqueeze@{csqueeze}}
\index{csqueeze@{csqueeze}!KStringHandler@{KString\-Handler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KString\-Handler::csqueeze (const {\bf QString} \& {\em str}, uint {\em maxlen} = {\tt 40})\hspace{0.3cm}{\tt  [static]}}\label{classKStringHandler_e17}


Substitute characters at the middle of a string by \char`\"{}...\char`\"{}. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em str}]is the string to modify \item[{\em maxlen}]is the maximum length the modified string will have If the original string is shorter than \char`\"{}maxlen\char`\"{}, it is returned verbatim \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the modified string \end{Desc}


Definition at line 289 of file kstringhandler.cpp.\index{KStringHandler@{KString\-Handler}!cEmSqueeze@{cEmSqueeze}}
\index{cEmSqueeze@{cEmSqueeze}!KStringHandler@{KString\-Handler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KString\-Handler::c\-Em\-Squeeze (const {\bf QString} \& {\em name}, const {\bf QFont\-Metrics} \& {\em font\-Metrics}, uint {\em maxlen} = {\tt 30})\hspace{0.3cm}{\tt  [static]}}\label{classKStringHandler_e18}


Substitute characters in the middle of a string by \char`\"{}...\char`\"{}. 

Similar to method above, except that it truncates based on pixel width rather than the number of characters \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em name}]is the string to modify \item[{\em font\-Metrics}]is the font metrics to use to calculate character sizes \item[{\em maxlen}]is the maximum length in ems the modified string will have If the original string is shorter than \char`\"{}maxlen\char`\"{}, it is returned verbatim \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the modified string \end{Desc}
\begin{Desc}
\item[Since:]3.2 \end{Desc}


Definition at line 337 of file kstringhandler.cpp.

References c\-Pixel\-Squeeze().\index{KStringHandler@{KString\-Handler}!cPixelSqueeze@{cPixelSqueeze}}
\index{cPixelSqueeze@{cPixelSqueeze}!KStringHandler@{KString\-Handler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KString\-Handler::c\-Pixel\-Squeeze (const {\bf QString} \& {\em name}, const {\bf QFont\-Metrics} \& {\em font\-Metrics}, uint {\em max\-Pixels})\hspace{0.3cm}{\tt  [static]}}\label{classKStringHandler_e19}


Substitute characters in the middle of a string by \char`\"{}...\char`\"{}. 

Similar to method above, except that maxlen is the width in pixels to truncate to \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em name}]is the string to modify \item[{\em font\-Metrics}]is the font metrics to use to calculate character sizes \item[{\em max\-Pixels}]is the maximum pixel length the modified string will have If the original string is shorter than \char`\"{}maxlen\char`\"{}, it is returned verbatim \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the modified string \end{Desc}
\begin{Desc}
\item[Since:]3.2 \end{Desc}


Definition at line 342 of file kstringhandler.cpp.

References QString::left(), QString::length(), and QString::right().

Referenced by c\-Em\-Squeeze().\index{KStringHandler@{KString\-Handler}!rsqueeze@{rsqueeze}}
\index{rsqueeze@{rsqueeze}!KStringHandler@{KString\-Handler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KString\-Handler::rsqueeze (const {\bf QString} \& {\em str}, uint {\em maxlen} = {\tt 40})\hspace{0.3cm}{\tt  [static]}}\label{classKStringHandler_e20}


Substitute characters at the end of a string by \char`\"{}...\char`\"{}. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em str}]is the string to modify \item[{\em maxlen}]is the maximum length the modified string will have If the original string is shorter than \char`\"{}maxlen\char`\"{}, it is returned verbatim \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the modified string \end{Desc}


Definition at line 298 of file kstringhandler.cpp.\index{KStringHandler@{KString\-Handler}!rEmSqueeze@{rEmSqueeze}}
\index{rEmSqueeze@{rEmSqueeze}!KStringHandler@{KString\-Handler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KString\-Handler::r\-Em\-Squeeze (const {\bf QString} \& {\em name}, const {\bf QFont\-Metrics} \& {\em font\-Metrics}, uint {\em maxlen} = {\tt 30})\hspace{0.3cm}{\tt  [static]}}\label{classKStringHandler_e21}


Substitute characters at the end of a string by \char`\"{}...\char`\"{}. 

Similar to method above, except that it truncates based on pixel width rather than the number of characters \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em name}]is the string to modify \item[{\em font\-Metrics}]is the font metrics to use to calculate character sizes \item[{\em maxlen}]is the maximum length in ems the modified string will have If the original string is shorter than \char`\"{}maxlen\char`\"{}, it is returned verbatim \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the modified string \end{Desc}
\begin{Desc}
\item[Since:]3.2 \end{Desc}


Definition at line 384 of file kstringhandler.cpp.

References r\-Pixel\-Squeeze().\index{KStringHandler@{KString\-Handler}!rPixelSqueeze@{rPixelSqueeze}}
\index{rPixelSqueeze@{rPixelSqueeze}!KStringHandler@{KString\-Handler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KString\-Handler::r\-Pixel\-Squeeze (const {\bf QString} \& {\em name}, const {\bf QFont\-Metrics} \& {\em font\-Metrics}, uint {\em max\-Pixels})\hspace{0.3cm}{\tt  [static]}}\label{classKStringHandler_e22}


Substitute characters at the end of a string by \char`\"{}...\char`\"{}. 

Similar to method above, except that maxlen is the width in pixels to truncate to \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em name}]is the string to modify \item[{\em font\-Metrics}]is the font metrics to use to calculate character sizes \item[{\em max\-Pixels}]is the maximum pixel length the modified string will have If the original string is shorter than \char`\"{}maxlen\char`\"{}, it is returned verbatim \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the modified string \end{Desc}
\begin{Desc}
\item[Since:]3.2 \end{Desc}


Definition at line 389 of file kstringhandler.cpp.

References QString::is\-Empty(), QString::length(), and QString::remove().

Referenced by r\-Em\-Squeeze().\index{KStringHandler@{KString\-Handler}!matchFileName@{matchFileName}}
\index{matchFileName@{matchFileName}!KStringHandler@{KString\-Handler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KString\-Handler::match\-File\-Name (const {\bf QString} \& {\em filename}, const {\bf QString} \& {\em pattern})\hspace{0.3cm}{\tt  [static]}}\label{classKStringHandler_e23}


Match a filename. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em filename}]is the real decoded filename (or dirname without trailing '/'). \item[{\em pattern}]is a pattern like $\ast$.txt, $\ast$.tar.gz, Makefile.$\ast$, $\ast$README$\ast$, etc. Patterns with two asterisks like \char`\"{}$\ast$.$\ast$pk\char`\"{} are not supported. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]true if the given filename matches the given pattern \end{Desc}


Definition at line 417 of file kstringhandler.cpp.

References QString::find(), QString::length(), and QString::unicode().\index{KStringHandler@{KString\-Handler}!perlSplit@{perlSplit}}
\index{perlSplit@{perlSplit}!KStringHandler@{KString\-Handler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString\-List} KString\-Handler::perl\-Split (const {\bf QString} \& {\em sep}, const {\bf QString} \& {\em s}, uint {\em max} = {\tt 0})\hspace{0.3cm}{\tt  [static]}}\label{classKStringHandler_e24}


Split a {\bf QString} into a {\bf QString\-List} in a similar fashion to the static {\bf QString\-List} function in {\bf Qt}, except you can specify a maximum number of tokens. 

If max is specified (!= 0) then only that number of tokens will be extracted. The final token will be the remainder of the string.

Example: 

\footnotesize\begin{verbatim} perlSplit("__", "some__string__for__you__here", 4)
 QStringList contains: "some", "string", "for", "you__here"
\end{verbatim}
\normalsize


\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em sep}]is the string to use to delimit s. \item[{\em s}]is the input string \item[{\em max}]is the maximum number of extractions to perform, or 0. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]A {\bf QString\-List} containing tokens extracted from s. \end{Desc}


Definition at line 456 of file kstringhandler.cpp.\index{KStringHandler@{KString\-Handler}!perlSplit@{perlSplit}}
\index{perlSplit@{perlSplit}!KStringHandler@{KString\-Handler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString\-List} KString\-Handler::perl\-Split (const {\bf QChar} \& {\em sep}, const {\bf QString} \& {\em s}, uint {\em max} = {\tt 0})\hspace{0.3cm}{\tt  [static]}}\label{classKStringHandler_e25}


Split a {\bf QString} into a {\bf QString\-List} in a similar fashion to the static {\bf QString\-List} function in {\bf Qt}, except you can specify a maximum number of tokens. 

If max is specified (!= 0) then only that number of tokens will be extracted. The final token will be the remainder of the string.

Example: 

\footnotesize\begin{verbatim} perlSplit(' ', "kparts reaches the parts other parts can't", 3)
 QStringList contains: "kparts", "reaches", "the parts other parts can't"
\end{verbatim}
\normalsize


\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em sep}]is the character to use to delimit s. \item[{\em s}]is the input string \item[{\em max}]is the maximum number of extractions to perform, or 0. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]A {\bf QString\-List} containing tokens extracted from s. \end{Desc}


Definition at line 482 of file kstringhandler.cpp.\index{KStringHandler@{KString\-Handler}!perlSplit@{perlSplit}}
\index{perlSplit@{perlSplit}!KStringHandler@{KString\-Handler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString\-List} KString\-Handler::perl\-Split (const {\bf QReg\-Exp} \& {\em sep}, const {\bf QString} \& {\em s}, uint {\em max} = {\tt 0})\hspace{0.3cm}{\tt  [static]}}\label{classKStringHandler_e26}


Split a {\bf QString} into a {\bf QString\-List} in a similar fashion to the static {\bf QString\-List} function in {\bf Qt}, except you can specify a maximum number of tokens. 

If max is specified (!= 0) then only that number of tokens will be extracted. The final token will be the remainder of the string.

Example: 

\footnotesize\begin{verbatim} perlSplit(QRegExp("[! ]", "Split me up ! I'm bored ! OK ?", 3)
 QStringList contains: "Split", "me", "up ! I'm bored, OK ?"
\end{verbatim}
\normalsize


\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em sep}]is the regular expression to use to delimit s. \item[{\em s}]is the input string \item[{\em max}]is the maximum number of extractions to perform, or 0. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]A {\bf QString\-List} containing tokens extracted from s. \end{Desc}


Definition at line 508 of file kstringhandler.cpp.\index{KStringHandler@{KString\-Handler}!tagURLs@{tagURLs}}
\index{tagURLs@{tagURLs}!KStringHandler@{KString\-Handler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KString\-Handler::tag\-URLs (const {\bf QString} \& {\em text})\hspace{0.3cm}{\tt  [static]}}\label{classKStringHandler_e27}


This method auto-detects URLs in strings, and adds HTML markup to them so that richtext or HTML-enabled widgets (such as {\bf KActive\-Label}) will display the URL correctly. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em text}]the string which may contain URLs \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the resulting text \end{Desc}
\begin{Desc}
\item[Since:]3.1 \end{Desc}


Definition at line 535 of file kstringhandler.cpp.

References QString::length(), QReg\-Exp::matched\-Length(), QString::mid(), QString::replace(), and QReg\-Exp::search().\index{KStringHandler@{KString\-Handler}!obscure@{obscure}}
\index{obscure@{obscure}!KStringHandler@{KString\-Handler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KString\-Handler::obscure (const {\bf QString} \& {\em str})\hspace{0.3cm}{\tt  [static]}}\label{classKStringHandler_e28}


Obscure string by using a simple symmetric encryption. 

Applying the function to a string obscured by this function will result in the original string.

The function can be used to obscure passwords stored to configuration files. Note that this won't give you any more security than preventing that the password is directly copied and pasted.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em str}]string to be obscured \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]obscured string \end{Desc}
\begin{Desc}
\item[Since:]3.2 \end{Desc}


Definition at line 560 of file kstringhandler.cpp.

References QChar::unicode(), and QString::unicode().\index{KStringHandler@{KString\-Handler}!isUtf8@{isUtf8}}
\index{isUtf8@{isUtf8}!KStringHandler@{KString\-Handler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KString\-Handler::is\-Utf8 (const char $\ast$ {\em str})\hspace{0.3cm}{\tt  [static]}}\label{classKStringHandler_e29}


Guess whether a string is UTF8 encoded. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em str}]the string to check \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]true if UTF8. If false, the string is probably in Local8Bit. \end{Desc}
\begin{Desc}
\item[Since:]3.2 \end{Desc}


Definition at line 571 of file kstringhandler.cpp.

Referenced by from8Bit().\index{KStringHandler@{KString\-Handler}!from8Bit@{from8Bit}}
\index{from8Bit@{from8Bit}!KStringHandler@{KString\-Handler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KString\-Handler::from8Bit (const char $\ast$ {\em str})\hspace{0.3cm}{\tt  [static]}}\label{classKStringHandler_e30}


Construct {\bf QString} from a c string, guessing whether it is UTF8- or Local8Bit-encoded. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em str}]the input string \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the (hopefully correctly guessed) {\bf QString} representation of {\tt str} \end{Desc}
\begin{Desc}
\item[Since:]3.2 \end{Desc}


Definition at line 656 of file kstringhandler.cpp.

References QString::from\-Local8Bit(), QString::from\-Utf8(), is\-Utf8(), and KGlobal::static\-QString().

Referenced by KConfig\-Base::read\-Entry(), and KConfig\-Base::write\-Entry().\index{KStringHandler@{KString\-Handler}!matchFilename@{matchFilename}}
\index{matchFilename@{matchFilename}!KStringHandler@{KString\-Handler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}static KDE\_\-DEPRECATED bool KString\-Handler::match\-Filename (const {\bf QString} \& {\em filename}, const {\bf QString} \& {\em pattern})\hspace{0.3cm}{\tt  [inline, static]}}\label{classKStringHandler_e31}


\begin{Desc}
\item[{\bf Deprecated}]Use\end{Desc}
\begin{Desc}
\item[See also:]{\bf match\-File\-Name}{\rm (p.\,\pageref{classKStringHandler_e23})} () instead. \end{Desc}


Definition at line 436 of file kstringhandler.h.

The documentation for this class was generated from the following files:\begin{CompactItemize}
\item 
kstringhandler.h\item 
kstringhandler.cpp\end{CompactItemize}
