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

58 visualizaciones (últimos 30 días)
MathWorks Support Team
MathWorks Support Team el 25 de Ag. de 2024
Respondida: MathWorks Support Team el 25 de Ag. de 2024
単一引用符('文字列')と二重引用符("文字列")でそれぞれ文字列を囲った場合、両者の違いについて教えてください。

Respuesta aceptada

MathWorks Support Team
MathWorks Support Team el 25 de Ag. de 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

Más respuestas (0)

Categorías

Más información sobre 文字と文字列 en Help Center y File Exchange.

Etiquetas

Aún no se han introducido etiquetas.

Productos


Versión

R2021a

Community Treasure Hunt

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

Start Hunting!