1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
|
<HTML>
<head><title>String functions</title></head>
<BODY BGCOLOR=#FFFFFF>
<A NAME="topic1060"></A><CENTER>
<A HREF="wx.htm"><img align=center src="contents.gif" BORDER=0 ALT="Contents"></A> <A HREF="wx264.htm#functions"><img align=center src="up.gif" BORDER=0 ALT="Up"></A> <A HREF="wx265.htm#filefunctions"><img align=center src="back.gif" BORDER=0 ALT="Previous"></A> <A HREF="wx267.htm#dialogfunctions"><img align=center src="forward.gif" BORDER=0 ALT="Next"></A> </CENTER><HR>
<H2>String functions</H2>
<P>
<A HREF="#topic1061">::copystring</A><BR>
<A HREF="#topic1062">::wxStringMatch</A><BR>
<A HREF="#wxstringeq">::wxStringEq</A><BR>
<A HREF="#isempty">::IsEmpty</A><BR>
<A HREF="#stricmp">::Stricmp</A><BR>
<A HREF="#strlen">::Strlen</A><BR>
<A HREF="#wxgettranslation">::wxGetTranslation</A><BR>
<P>
<HR>
<A NAME="topic1061"></A>
<H3>::copystring</H3>
<P>
<B>char*</B> <B>copystring</B>(<B>const char* </B><I>s</I>)<P>
Makes a copy of the string <I>s</I> using the C++ new operator, so it can be
deleted with the <I>delete</I> operator.<P>
<HR>
<A NAME="topic1062"></A>
<H3>::wxStringMatch</H3>
<P>
<B>bool</B> <B>wxStringMatch</B>(<B>const wxString& </B><I>s1</I>, <B>const wxString& </B><I>s2</I>,<BR>
<B>bool</B><I> subString = TRUE</I>, <B>bool</B><I> exact = FALSE</I>)<P>
Returns TRUE if the substring <I>s1</I> is found within <I>s2</I>,
ignoring case if <I>exact</I> is FALSE. If <I>subString</I> is FALSE,
no substring matching is done.<P>
<HR>
<A NAME="wxstringeq"></A>
<H3>::wxStringEq</H3>
<P>
<B>bool</B> <B>wxStringEq</B>(<B>const wxString& </B><I>s1</I>, <B>const wxString& </B><I>s2</I>)<P>
A macro defined as:<P>
<PRE>
#define wxStringEq(s1, s2) (s1 && s2 && (strcmp(s1, s2) == 0))
</PRE>
<HR>
<A NAME="isempty"></A>
<H3>::IsEmpty</H3>
<P>
<B>bool</B> <B>IsEmpty</B>(<B>const char *</B><I> p</I>)<P>
Returns TRUE if the string is empty, FALSE otherwise. It is safe to pass NULL
pointer to this function and it will return TRUE for it.<P>
<HR>
<A NAME="stricmp"></A>
<H3>::Stricmp</H3>
<P>
<B>int</B> <B>Stricmp</B>(<B>const char *</B><I>p1</I>, <B>const char *</B><I>p2</I>)<P>
Returns a negative value, 0, or positive value if <I>p1</I> is less than, equal
to or greater than <I>p2</I>. The comparison is case-insensitive.<P>
This function complements the standard C function <I>strcmp()</I> which performs
case-sensitive comparison.<P>
<HR>
<A NAME="strlen"></A>
<H3>::Strlen</H3>
<P>
<B>size_t</B> <B>Strlen</B>(<B>const char *</B><I> p</I>)<P>
This is a safe version of standard function <I>strlen()</I>: it does exactly the
same thing (i.e. returns the length of the string) except that it returns 0 if
<I>p</I> is the NULL pointer.<P>
<HR>
<A NAME="wxgettranslation"></A>
<H3>::wxGetTranslation</H3>
<P>
<B>const char *</B> <B>wxGetTranslation</B>(<B>const char * </B><I>str</I>)<P>
This function returns the translation of string <I>str</I> in the current
<A HREF="wx131.htm#wxlocale">locale</A>. If the string is not found in any of the loaded
message catalogs (see <A HREF="wx315.htm#internationalization">i18n overview</A>), the
original string is returned. In debug build, an error message is logged - this
should help to find the strings which were not yet translated. As this function
is used very often, an alternative syntax is provided: the _() macro is
defined as wxGetTranslation().<P>
</BODY></HTML>
|