180
string emptytest = "Tell me and I forget.\n \n \nTeach me and I remember. \r\n \r\n\r\nInvolve me and I learn. \r \r\r\0\r\r Pad Unicode \\u0080 next line\n\n\u0080\r\rby Benjamin Franklin.\r\n";
1
using System;
2
using System.Text;
3
using System.IO;
4
using System.Diagnostics;
5
using System.Text.RegularExpressions;
6
7
public static class Program
8
{
9
10
public static string RemoveAllWhitespace(this string str)
11
{
12
var len = str.Length;
13
var src = str.ToCharArray();
14
var dstIdx = 0;
15
for (var i = 0; i < len; i++)
16
{
17
char ch = src[i];
18
if (!char.IsWhiteSpace(ch) && ch != '\0')
19
//ch!='\0')
20
src[dstIdx++] = ch;
21
22
}
23
return new string(src, 0, dstIdx);
24
}
Cached Result
Tell me and I forget.
Teach me and I remember.
Involve me and I learn. Pad Unicode \u0080 next line
by Benjamin Franklin.
in 516007 ticks
-------- StringReader Issue ----------------
is string '\0' empty or null = False
is string '\0' whitespace or null = False
is char '\0' char.IsWhiteSpace = False
is char '\0' char.IsControl = True
is string '\0080' empty or null = False
is string '\0080' whitespace or null = False
Tell me and I forget.
Teach me and I remember.
Involve me and I learn.
Pad Unicode \u0080 next line
by Benjamin Franklin.
in 553608 ticks
-------- StringReader Final ----------------
Tell me and I forget.
Teach me and I remember.
Involve me and I learn.
Pad Unicode \u0080 next line
by Benjamin Franklin.
in 413406 ticks
-------- Regex ----------------
Tell me and I forget.
Teach me and I remember.
Involve me and I learn. Pad Unicode \u0080 next line
by Benjamin Franklin.
in 9350130 ticks
Teach me and I remember.
Involve me and I learn. Pad Unicode \u0080 next line
by Benjamin Franklin.
in 516007 ticks
-------- StringReader Issue ----------------
is string '\0' empty or null = False
is string '\0' whitespace or null = False
is char '\0' char.IsWhiteSpace = False
is char '\0' char.IsControl = True
is string '\0080' empty or null = False
is string '\0080' whitespace or null = False
Tell me and I forget.
Teach me and I remember.
Involve me and I learn.
Pad Unicode \u0080 next line
by Benjamin Franklin.
in 553608 ticks
-------- StringReader Final ----------------
Tell me and I forget.
Teach me and I remember.
Involve me and I learn.
Pad Unicode \u0080 next line
by Benjamin Franklin.
in 413406 ticks
-------- Regex ----------------
Tell me and I forget.
Teach me and I remember.
Involve me and I learn. Pad Unicode \u0080 next line
by Benjamin Franklin.
in 9350130 ticks