[12] [DFN[[RUBY[文字列][もじれつ]@en[string]]]]は、[[符号位置]]の[RUBYB[[[列]]]@en[sequence]]です
[SRC[>>11]]。

* 仕様書

[REFS[
- [35] [CITE[[[The Unicode Standard]], Version 13.0 - ch03.pdf]], [TIME[2020-03-09T17:53:34.000Z]], [TIME[2020-12-20T02:08:18.239Z]] <https://www.unicode.org/versions/latest/ch03.pdf#G2212>
- [33] [CITE[[[The Unicode Standard]], Version 13.0 - ch03.pdf]], [TIME[2020-03-09T17:53:34.000Z]], [TIME[2020-12-20T07:49:38.210Z]] <https://www.unicode.org/versions/latest/ch03.pdf#G7404>
- [11] [CITE@en-US[Encoding Standard]] ([TIME[2015-08-19 23:19:23 +09:00]] 版) <https://encoding.spec.whatwg.org/#string>
]REFS]

* 用語

[14] [[Encoding Standard]] は[[符号位置]]の列としていますが、
その他の文脈では[[Unicodeスカラー値]]の列が[[文字列]]と呼ばれることもあります。
多くの場合、どちらであるかは曖昧です。

[13] 現代では普通は[[文字列]]というと、
[DFN[[RUBYB[Unicode文字列]@en[Unicode string]]]]のことを指しています。
他の[[文字コード]]の[[文字列]]が使われることはほとんどなくなってきています。

-*-*-

[29] 
[DFN[[RUBY[符号化済文字列][ふごうかずみもじれつ][coded character sequence]]]]
([DFN[[RUBY[符号化済文字表現][ふごうかずみもじひょうげん][coded character representation]]]])
は、
1つ[[以上]]の[[符号点]]の[[順序付き列]]です。
[SRC[>>35 D12]]
[CITE[The Unicode Standard]]
では、特に断らない限り、
[DFN[[RUBYB[[RUBY[文字][もじ]]の[RUBY[列][れつ]]][character sequence]]]]とは[[符号化済文字列]]です
[SRC[>>35]]。


[30] 名前に反して[[符号化済文字]]の列ではありません。
通常は[[符号化済文字]]で構成されますが、
それ以外に[[非文字]]や[[予約済符号点]]を含むこともあります。

[FIG(railroad)[ [31] [[符号化済文字列]]
= +
== [[符号点]]
]FIG]


[34] 
[DFN[Unicode[RUBY[文字列][もじれつ][string]]]]は、
特定の
[[Unicode符号化形]]の[[符号単位]]を含んだ[[符号単位列]]です。
[SRC[>>33 D80]]


[FIG(railroad)[ [36] [[Unicode文字列]]
= +
== [[符号単位]]
]FIG]



[32] [[符号化済文字列]]、[[Unicode文字列]]、
[[抽象文字列]]は似たように見えて構成要素が違います。

[37] 
これら
[[Unicode]]
系の定義は[[空文字列]]を認めていません。

* データ型


[FIG(short list)[ [40] [DFN[文字列データ型]]

- [[JavaScript文字列]]
- [[utf8フラグ]]
- [[文字列 (X.500)]]
- [[文字のようなもの]]


]FIG]






* 演算

[FIG(short list)[ [39] [DFN[文字列処理]]
- [[文字列連結]]
- [[文字列の一致]]
- [[文字列の比較]]
- [[大文字と小文字]]
- [[文字列の整列]]
- [[文字コードの変換]]
- [[Unicode正規化]]
- [[文字のレンダリング]]
- [[構文解析]]

]FIG]


[41] 
[CITE[いやなブログ: 文字列操作の比較表: Ruby, Python, JavaScript, Perl, C++]],
[TIME[2006-10-22 23:57:46 +00:00]]
<http://0xcc.net/blog/archives/000137.html>



* 関連

[15] 歴史的にはよく[[バイト列]]や[[オクテット列]]と混同されていました。
現代の[[プログラミング言語]]などでは明確に区別するのが普通ですが、
暗黙のうちに[[型変換]]される場合もあり、取り扱いには注意が必要です。
[[プロトコル]]の[[仕様書]]などでは現在でも区別が不明瞭なことがあり、
注意が必要です。

* メモ

[1]
>
:(298) (文字)列 [(character) string]:
[[文字]]の[[並び]]。[SRC[[[JIS X 4151]]-1992 3.]]



[2] [CITE[JavaScript の文字列連結ベンチマーク - ぐま あーかいぶ]]
( ([TIME[2014-01-18 11:58:17 +09:00]] 版))
<http://archive.guma.jp/2010/11/javascript-1.html>

[3] [CITE[JavaScript - 文字列の結合方法による速度差 - Qiita]]
( ([TIME[2014-02-17 08:46:38 +09:00]] 版))
<http://qiita.com/se_ino/items/0322e0820badf2c020be>

[4] [CITE[文字列の結合 - ひきメモ]]
( ([TIME[2014-02-17 08:47:18 +09:00]] 版))
<http://d.hatena.ne.jp/yumimue/20071226/1198670253>

[5] [CITE@ja[文字列操作の速度比較 - misc.log]]
( ([TIME[2014-02-17 08:47:30 +09:00]] 版))
<http://backyard.hatenablog.com/entry/20041202/1173749287>

[6] [CITE[理由がない限り、Array.join("") による文字列連結は使わないほうがいいみたい - latest log]]
( ([TIME[2014-02-17 08:48:40 +09:00]] 版))
<http://d.hatena.ne.jp/uupaa/20090828/1251418928>

[7] ( ([TIME[2011-08-20 09:59:56 +09:00]] 版))
<http://ll.jus.or.jp/2011/slide/LT/2011-LL-kuwata.pdf>

[8] [CITE@en[XQuery and XPath Data Model 3.0]]
( ([TIME[2014-04-08 07:00:06 +09:00]] 版))
<http://www.w3.org/TR/xpath-datamodel-3/#dt-string>

[9] [CITE@EN[XPath and XQuery Functions and Operators 3.0]]
( ([TIME[2014-04-08 07:02:07 +09:00]] 版))
<http://www.w3.org/TR/xpath-functions-3/#string>

[10] [CITE@en[Character Model for the World Wide Web 1.0: Fundamentals]]
( ([TIME[2005-02-15 14:24:00 +09:00]] 版))
<http://www.w3.org/TR/charmod/#def-character-string>

[16] [CITE@en[Editorial: start using the Infra Standard]]
([[annevk]]著, [TIME[2016-11-18 20:21:54 +09:00]])
<https://github.com/whatwg/encoding/commit/a26f76889bf393999e9caad84a3647ab09c39e09>

[17] [CITE@en[XQuery and XPath Data Model 3.1]]
([TIME[2017-03-20 07:26:25 +09:00]])
<https://www.w3.org/TR/2017/REC-xpath-datamodel-31-20170321/#dt-string>

[18] [CITE@EN[XPath and XQuery Functions and Operators 3.1]]
([TIME[2017-03-21 16:02:06 +09:00]])
<https://www.w3.org/TR/2017/REC-xpath-functions-31-20170321/#string>

[19] [CITE@en[Define JavaScript string and scalar value string]]
([[annevk]]著, [TIME[2017-03-27 16:01:49 +09:00]])
<https://github.com/whatwg/infra/commit/f1be763cfba23d2fc780b35403074c599e69616e>

[20] [CITE@en[String byte escapes seem wrong · Issue #577 · WebAssembly/spec]]
([TIME[2017-10-14 22:43:24 +09:00]])
<https://github.com/WebAssembly/spec/issues/577>

[21] [CITE@en[Strings on the Web: Language and Direction Metadata]]
([TIME[2019-06-11 19:43:37 +09:00]])
<https://w3c.github.io/string-meta/>

[22] [CITE@en[Strings on the Web: Language and Direction Metadata]]
([TIME[2019-06-11 19:53:35 +09:00]])
<https://www.w3.org/TR/2019/WD-string-meta-20190611/>

[23] [CITE@en[Strings on the Web: Language and Direction Metadata]]
([TIME[2019-04-11 01:13:59 +09:00]])
<https://www.w3.org/TR/2019/WD-string-meta-20190416/>

[24] [CITE@en[Editorial: rename "Plain Unicode string" to "text" for drag data store]]
([[karx]]著, [TIME[2019-08-10 06:06:12 +09:00]])
<https://github.com/whatwg/html/commit/817ee1b69398ea385d639a35450cc218463bff0d>

[25] [CITE@en[Plain Unicode string · Issue #4798 · whatwg/html · GitHub]]
([TIME[2020-07-13 11:55:10 +09:00]])
<https://github.com/whatwg/html/issues/4798>

[26] [CITE@en['''['''Re''']''' Rename "Plain Unicode string" to "text" by karx · Pull Request #4827 · whatwg/html · GitHub]]
([TIME[2020-07-13 11:56:01 +09:00]])
<https://github.com/whatwg/html/pull/4827>

[27] [CITE@en[Incorrect algorithm for byte sequence starts with and string code unit prefix · Issue #256 · whatwg/infra]]
([TIME[2020-07-13 14:59:25 +09:00]])
<https://github.com/whatwg/infra/issues/256>

[28] [CITE@en[Fix "starts with" and "code unit prefix" algorithm by al-arz · Pull Request #259 · whatwg/infra]]
([TIME[2020-07-13 14:59:57 +09:00]])
<https://github.com/whatwg/infra/pull/259>


[38] 
[CITE@en-us[UTS #18: Unicode Regular Expressions]], [TIME[2022-02-08T14:02:12.000Z]], [TIME[2022-11-13T03:27:15.591Z]] <https://unicode.org/reports/tr18/#character_ranges>

>For the purpose of regular expressions, in this document the terms “character” and “code point” are used interchangeably. Similarly, the terms “string” and “sequence of code points” are used interchangeably. [SNIP[]]



