This would be dependent upon the environment. As noted by Microsoft \r\n
for Windows.
A string containing "\r\n" for non-Unix platforms, or a string containing "\n" for Unix platforms.
题
I want to know if pressing Enter from the keyboard in a WPF TextBox
which has AcceptsReturn="true"
will always put in \r\n
or is it system dependent?
Is it equal to System.Environment.NewLine
?
How do I get these characters programmatically?
I want something like string enter = Key.Enter.toSomething()...
that will end up with something like \r\n
or \n
.
string enter = Convert.ToString(Key.Enter)
will just give me "Return"
and other than that conversion there is the possibility to get an int
value which is 6
, which I can't interpret (or should I be able to?).
Are there any issues I need to consider like the ones mentioned here: http://blogs.catapultsystems.com/asills/archive/2010/10/09/tip-silverlight-textbox-uses-r-for-new-lines-not-environment-newline.aspx ?
解决方案
This would be dependent upon the environment. As noted by Microsoft \r\n
for Windows.
A string containing "\r\n" for non-Unix platforms, or a string containing "\n" for Unix platforms.