开发者

What is Delphi Prism LineFeed

What is the equivalent of C#'s \n and Visual Basic's vbCRLF or vbNewLine in Delphi Prism? Do I have to use Envi开发者_StackOverflow中文版ronment.NewLine?


Environment.NewLine is actually the best thing to use, as it is supposed to be platform independent. This guidance goes for C# as well, by the way.


MyString := 'One'#13#10'Two'; would be the equivalent of c#'s "One\r\nTwo".


The appropriate new line character is not a question of runtime platform or language choice, it is a question of the source (or intended recipient) of the output file. If the file is entirely for private use by an application (only ever read/written by the app) then you can use whatever character you like to delimit lines.

If you need to exchange the file with some party or process outside of the application itself then the needs of that other party may well dictate what you should expect (and are expected) to use as the new line character.

To answer the actual question as put however, the equivalent of vbCRLF is (as a literal value) #13#10 and the equivalent of vbNewLine would be #10 (#13 is the char code for CR and #10 for LF).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜