Tam*_*inn 1 string ada multiline literals
如何在Ada中创建一个包含换行符的字符串,其定义也包含这些换行符?
我尝试在行尾使用0..2反斜杠,但是没有一个可以编译:
usage_info : String := "\
This should be the first line
and both the definition and the output
should contain newlines.";
Run Code Online (Sandbox Code Playgroud)
在PHP中,这将是:
<<<BLOCK
1
2
3
BLOCK;
Run Code Online (Sandbox Code Playgroud)
const std::string s = "\
1
2
3";
Run Code Online (Sandbox Code Playgroud)
const string s =
@"1
2
3";
Run Code Online (Sandbox Code Playgroud)
据我了解,Ada与Java一样,不支持多行文字。我唯一看到的是这样的:
usage_info : String := "This should be the first line" & CR & LF
& "and both the definition and the output" & CR & LF
& "should contain newlines.";
Run Code Online (Sandbox Code Playgroud)
当然,您需要使用并使用 Ada.Characters.Latin_1来使这些常量可见。
| 归档时间: |
|
| 查看次数: |
100 次 |
| 最近记录: |