名前空間
変種
操作

std::strxfrm

提供: cppreference.com
< cpp‎ | string‎ | byte

 
 
ストリングスライブラリ
NULLで終わる文字列
Original:
Null-terminated strings
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
バイト文字列
文字列をマルチバイト
ワイド文字列
クラス
Original:
Classes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_string
char_traits
 
NULL終端バイト文字列
機能します
Original:
Functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
文字操作
Original:
Character manipulation
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
数値形式への変換
Original:
Conversions to numeric formats
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
文字列操作
Original:
String manipulation
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
strcpy
strncpy
strcat
strncat
strxfrm
文字列の検査
Original:
String examination
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
メモリ操作
Original:
Memory manipulation
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
memchr
memcmp
memset
memcpy
memmove
その他
Original:
Miscellaneous
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
strerror
 
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.
変換された文字列の最初の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.
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.

目次

[編集] ノート

全体の変換された文字列を受け取ることができるバッファの正しい長さが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.

[編集] パラメータ

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.

[編集]

#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';
 
}

Output:

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.

(機能) [edit]
その照合は比較に置き換えることができるように文字列を変換します
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) [edit]
現在のロケールに応じた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.

(機能) [edit]
C documentation for strxfrm