Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
I need CHR(10) in C#!
Message
From
09/01/2013 04:31:56
 
 
To
08/01/2013 19:10:18
Joel Leach
Memorial Business Systems, Inc.
Tennessee, United States
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
C# 5.0
OS:
Windows 7
Miscellaneous
Thread ID:
01561827
Message ID:
01561852
Views:
44
>Here's my scenario: I am storing a small number as a single character in a string. If that number happens to be 10, C# is converting it to "\n". I imagine I will run into the problem with other escape codes as well. I really need CHR(10) to be stored in the string, not "\n". I've tried Convert.ToChar(myint), (char)myint, and even went so far as to use VisualBasic.Strings.Chr(), but it always comes back as "\n" in the string. The string is later encrypted, and that's where it is really messing things up. Is there anyway to "escape the escape" and prevent this from happening?
>
>Thanks.

I think you're confusing the stored value with how it is displayed.
int x = 10;
int y = 256;
string s = new string(new char[]{(char)x, (char) y});
int x2 = s[0];
int y2 = s[1];
Previous
Reply
Map
View

Click here to load this message in the networking platform