summaryrefslogtreecommitdiff
path: root/devdocs/c/string%2Fwide%2Fwcscoll.html
diff options
context:
space:
mode:
Diffstat (limited to 'devdocs/c/string%2Fwide%2Fwcscoll.html')
-rw-r--r--devdocs/c/string%2Fwide%2Fwcscoll.html58
1 files changed, 58 insertions, 0 deletions
diff --git a/devdocs/c/string%2Fwide%2Fwcscoll.html b/devdocs/c/string%2Fwide%2Fwcscoll.html
new file mode 100644
index 00000000..d011acc3
--- /dev/null
+++ b/devdocs/c/string%2Fwide%2Fwcscoll.html
@@ -0,0 +1,58 @@
+ <h1 id="firstHeading" class="firstHeading">wcscoll</h1> <table class="t-dcl-begin"> <tr class="t-dsc-header"> <th> Defined in header <code>&lt;wchar.h&gt;</code> </th> <th> </th> <th> </th> </tr> <tr class="t-dcl"> <td> <pre data-language="c">int wcscoll( const wchar_t *lhs, const wchar_t *rhs );</pre>
+</td> <td class="t-dcl-nopad"> </td> <td> <span class="t-mark-rev t-since-c95">(since C95)</span> </td> </tr> </table> <p>Compares two null-terminated wide strings according to the collation order defined by the <code><a href="../../locale/lc_categories" title="c/locale/LC categories">LC_COLLATE</a></code> category of the currently installed locale.</p>
+<h3 id="Parameters"> Parameters</h3> <table class="t-par-begin"> <tr class="t-par"> <td> lhs, rhs </td> <td> - </td> <td> pointers to the null-terminated wide strings to compare </td>
+</tr>
+</table> <h3 id="Return_value"> Return value</h3> <p>Negative value if <code>lhs</code> is <i>less than</i> (precedes) <code>rhs</code>.</p>
+<p><code>​0​</code> if <code>lhs</code> is <i>equal to</i> <code>rhs</code>.</p>
+<p>Positive value if <code>lhs</code> is <i>greater than</i> (follows) <code>rhs</code>.</p>
+<h3 id="Notes"> Notes</h3> <p>Collation order is the dictionary order: the position of the letter in the national alphabet (its <i>equivalence class</i>) has higher priority than its case or variant. Within an equivalence class, lowercase characters collate before their uppercase equivalents and locale-specific order may apply to the characters with diacritics. In some locales, groups of characters compare as single <i>collation units</i>. For example, <code>"ch"</code> in Czech follows <code>"h"</code> and precedes <code>"i"</code>, and <code>"dzs"</code> in Hungarian follows <code>"dz"</code> and precedes <code>"g"</code>.</p>
+<h3 id="Example"> Example</h3> <div class="t-example"> <div class="c source-c"><pre data-language="c">#include &lt;stdio.h&gt;
+#include &lt;wchar.h&gt;
+#include &lt;locale.h&gt;
+
+void try_compare(const wchar_t* p1, const wchar_t* p2)
+{
+ if(wcscoll(p1, p2) &lt; 0)
+ printf("%ls before %ls\n", p1, p2);
+ else
+ printf("%ls before %ls\n", p2, p1);
+}
+
+int main(void)
+{
+ setlocale(LC_ALL, "en_US.utf8");
+ printf("In the American locale: ");
+ try_compare(L"hrnec", L"chrt");
+
+ setlocale(LC_COLLATE, "cs_CZ.utf8");
+ printf("In the Czech locale: ");
+ try_compare(L"hrnec", L"chrt");
+
+ setlocale(LC_COLLATE, "en_US.utf8");
+ printf("In the American locale: ");
+ try_compare(L"år", L"ängel");
+
+ setlocale(LC_COLLATE, "sv_SE.utf8");
+ printf("In the Swedish locale: ");
+ try_compare(L"år", L"ängel");
+}</pre></div> <p>Possible output:</p>
+<div class="text source-text"><pre data-language="c">In the American locale: chrt before hrnec
+In the Czech locale: hrnec before chrt
+In the American locale: ängel before år
+In the Swedish locale: år before ängel</pre></div> </div> <h3 id="References"> References</h3> <ul>
+<li> C11 standard (ISO/IEC 9899:2011): </li>
+<ul><li> 7.29.4.4.2 The wcscoll function (p: 433-434) </li></ul>
+<li> C99 standard (ISO/IEC 9899:1999): </li>
+<ul><li> 7.24.4.4.2 The wcscoll function (p: 379-380) </li></ul>
+</ul> <h3 id="See_also"> See also</h3> <table class="t-dsc-begin"> <tr class="t-dsc"> <td> <div><a href="../byte/strcoll" title="c/string/byte/strcoll"> <span class="t-lines"><span>strcoll</span></span></a></div> </td> <td> compares two strings in accordance to the current locale <br> <span class="t-mark">(function)</span> </td>
+</tr> <tr class="t-dsc"> <td> <div><a href="wcsxfrm" title="c/string/wide/wcsxfrm"> <span class="t-lines"><span>wcsxfrm</span></span></a></div>
+<div><span class="t-lines"><span><span class="t-mark-rev t-since-c95">(C95)</span></span></span></div> </td> <td> transform a wide string so that wcscmp would produce the same result as wcscoll <br> <span class="t-mark">(function)</span> </td>
+</tr> <tr class="t-dsc"> <td> <div><a href="wcscmp" title="c/string/wide/wcscmp"> <span class="t-lines"><span>wcscmp</span></span></a></div>
+<div><span class="t-lines"><span><span class="t-mark-rev t-since-c95">(C95)</span></span></span></div> </td> <td> compares two wide strings <br> <span class="t-mark">(function)</span> </td>
+</tr> <tr class="t-dsc"> <td colspan="2"> <span><a href="https://en.cppreference.com/w/cpp/string/wide/wcscoll" title="cpp/string/wide/wcscoll">C++ documentation</a></span> for <code>wcscoll</code> </td>
+</tr> </table> <div class="_attribution">
+ <p class="_attribution-p">
+ &copy; cppreference.com<br>Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.<br>
+ <a href="https://en.cppreference.com/w/c/string/wide/wcscoll" class="_attribution-link">https://en.cppreference.com/w/c/string/wide/wcscoll</a>
+ </p>
+</div>