여러 줄 문자열

이 경고 카테고리의 철자는 [multiline-strings] 입니다.

문자열에 이스케이프되지 않은 줄 종결자가 포함되어 있으며 더 이상 사용되지 않습니다.

무슨 일인가요?

문자열이 여러 줄에 걸쳐 있습니다.

이것이 왜 나쁜가요?

여러 줄에 걸쳐 있는 문자열은 ECMAScript의 비표준 확장이며 QML에서 더 이상 사용되지 않습니다. 대신 템플릿 리터럴을 사용하세요.

예제

import QtQuick

Item {
    property string multiLine: "first
second
third"

    property string multiLine2: 'first
second
third'
}

이 경고를 해결하려면 템플릿 리터럴을 사용하거나 개행 줄을 '\n'으로 바꾸세요:

import QtQuick

Item {
    property string multiLine: `first
second
third`
    property string multiLine2: `first
second
third`

    property string alternative: "first\nsecond\nthird"
    property string alternative2: "first\n" +
"second\n" +
"third"
}

© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.