std::strxfrm
提供: cppreference.com
|
|
このページは、Google 翻訳を使って英語版から機械翻訳されました。
翻訳には誤りや奇妙な言い回しがあるかもしれません。文章の上にポインタをおくと、元の文章が見れます。誤りを修正して翻訳を改善する手助けをしてください。翻訳についての説明は、ここをクリックしてください。 |
| Defined in header <cstring>
|
||
| std::size_t strxfrm( const char* dest, const char* src, std::size_t count ); |
||
srcを持つ2つの変換された文字列を比較すると、現在のCロケールで、std::strcmpで元の文字列を比較するのと同じ結果を与えるような実装で定義された形式にstd::strcollが指すNULL終端バイト文字列を変換します.Original:
Transforms the null-terminated byte string pointed to by
src into the implementation-defined form such that comparing two transformed strings with std::strcmp gives the same result as comparing the original strings with std::strcoll, in the current C locale.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
変換された文字列の最初の
count文字が終端のNULL文字を含む、先に書き込まれており、完全な変換された文字列の長さは、終端のNULL文字を除く、返された.Original:
The first
count characters of the transformed string are written to destination, including the terminating null character, and the length of the full transformed string is returned, excluding the terminating null character.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
count0であれば、destはNULLポインタであることが許可されている.Original:
If
count is 0, then dest is allowed to be a null pointer.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
目次 |
[編集] ノート
全体の変換された文字列を受け取ることができるバッファの正しい長さが1+std::strxfrm(NULL, src, 0)です
Original:
The correct length of the buffer that can receive the entire transformed string is 1+std::strxfrm(NULL, src, 0)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[編集] パラメータ
| dest | - | 変換後の文字列が書き込まれる配列の最初の要素へのポインタ
Original: pointer to the first element of the array where the transformed string will be written The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
| src | - | 変換するNULL終端バイト文字列の最初の文字へのポインタ
Original: pointer to the first character of a null-terminated byte string to transform The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
| count | - | 書き込まれる文字の最大数
Original: maximum number of characters to be written The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
[編集] 値を返します
終端のNULL文字を含む変換された文字列の長さは、.
Original:
The length of the transformed string, not including the terminating null-character.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[編集] 例
このコードを実行します
#include <iostream> #include <iomanip> #include <cstring> int main() { std::setlocale(LC_COLLATE, "cs_CZ.iso88592"); std::string in1 = "hrnec"; std::string out1(1+std::strxfrm(nullptr, in1.c_str(), 0), ' '); std::string in2 = "chrt"; std::string out2(1+std::strxfrm(nullptr, in2.c_str(), 0), ' '); std::strxfrm(&out1[0], in1.c_str(), out1.size()); std::strxfrm(&out2[0], in2.c_str(), out2.size()); std::cout << "In the Czech locale: "; if(out1 < out2) std::cout << in1 << " before " << in2 << '\n'; else std::cout << in2 << " before " << in1 << '\n'; std::cout << "In lexicographical comparison: "; if(in1 < in2) std::cout << in1 << " before " << in2 << '\n'; else std::cout << in2 << " before " << in1 << '\n'; }
出力:
In the Czech locale: hrnec before chrt In lexicographical comparison: chrt before hrnec
[編集] 参照
| wcscmp関数は、wcscoll関数と同じ結果を生成するように、ワイド文字列を変換します Original: transform a wide string so that wcscmp would produce the same result as wcscoll The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (関数) | |
| [仮想] |
その照合は比較に置き換えることができるように文字列を変換します Original: transforms a string so that collation can be replaced by comparison The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (仮想protectedメンバ関数of std::collate)
|
| 現在のロケールに応じた2つの文字列を比較する Original: compares two strings in accordance to the current locale The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (関数) | |
| C documentation for strxfrm
| |

