単一引用符('文字列​')と二重引用符("​文字列")でそれぞれ​文字列を囲った場合、​両者に違いはあります​か?

28 vues (au cours des 30 derniers jours)
MathWorks Support Team
MathWorks Support Team le 25 Août 2024
単一引用符('文字列')と二重引用符("文字列")でそれぞれ文字列を囲った場合、両者の違いについて教えてください。

Réponse acceptée

MathWorks Support Team
MathWorks Support Team le 25 Août 2024
単一引用符(シングルコーテーション)で囲まれた文字列は、”char型”の配列(文字ベクトルや文字配列と呼ばれたりもします)です。
二重引用符(ダブルクォーテーション)で囲まれた文字列は、”string型”というデータ型として定義されます。
”string型”は、R2016bにて導入された比較的新しいデータ型となり、関数の入力引数などに文字列を与える場合、文字ベクトルや文字ベクトルのセル配列と基本的には互換性があり、相互の変換も可能です。
違いについては下記ドキュメンテーションご参照ください。
string 配列および文字配列内のテキスト
https://jp.mathworks.com/help/matlab/matlab_prog/represent-text-with-character-and-string-arrays.html
また、このあたり全般としては、下記ドキュメンテーションにリンクがまとめられておりますので、合わせてご参照ください。
文字と文字列
https://jp.mathworks.com/help/matlab/characters-and-strings.html

Plus de réponses (0)

Catégories

En savoir plus sur 文字と文字列 dans Help Center et File Exchange

Tags

Aucun tag saisi pour le moment.

Produits


Version

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!