Showing posts with label Visual Studio. Show all posts
Showing posts with label Visual Studio. Show all posts
[C#] 4 ways to remove "\r" or "\n" or "\t" new line or line break and tab characters from a string?
If you have a string, like this:
So you can using some methods:
Method 1: quick to code
string str = "Line 1\n Tab it.\t Break.\n'
How to remove breakline or tab in this string?
So you can using some methods:Method 1: quick to code
string newstr = Regex.Replace(str, @"\t|\n|\r", ""); // \t is tab, \n and \r is new line
Method 2: for New line onlystring newstr = str.Replace(Environment.NewLine, "");
Method 3: Easy to codestr = str.Replace("\n", String.Empty);
str = str.Replace("\r", String.Empty);
str = str.Replace("\t", String.Empty);
Method 4: For speed and low memory, because is StringBuilder best!var sb = new StringBuilder(s.Length);
foreach (char i in str)
if (i != '\n' && i != '\r' && i != '\t')
sb.Append(i);
str = sb.ToString();
12:21 AM
.Net
,
ASP
,
ASPX
,
C#
,
c# string
,
Special string
,
Visual Studio
Debugging mode not can not work with F10 and F11 Visual Studio 2010
(Continue with fix-debugger-not-working)
When I going to debug with Visual Studio 2010, It work!
But when I want to run line by line at break point. I press F11 and F10... => It not work!!!
Solutions to fix:
1. Install http://support.microsoft.com/default.aspx/kb/957912
2. Change the port of the Visual Studio development server (go to menu Project > Properties > Web > *Server: User Visual Studio Development Server: Specific port = 12345)
When I going to debug with Visual Studio 2010, It work!
But when I want to run line by line at break point. I press F11 and F10... => It not work!!!
Solutions to fix:
1. Install http://support.microsoft.com/default.aspx/kb/957912
2. Change the port of the Visual Studio development server (go to menu Project > Properties > Web > *Server: User Visual Studio Development Server: Specific port = 12345)
11:12 AM
.Net
,
ASPX
,
C#
,
debug
,
debugger
,
Visual Studio
,
Visual Studio 2010
Subscribe to:
Posts
(
Atom
)