Linked Questions
15 questions linked to/from Why is there no Char.Empty like String.Empty?
0
votes
3
answers
5k
views
If there is string.Empty why there is not char.Empty? [duplicate]
Possible Duplicate:
Why is there no Char.Empty like String.Empty?
I want to pass an empty char as a method parameter and I was wondering why I cannot say
char.Empty
while C# allows me to specify ...
126
votes
10
answers
175k
views
How to replace a char in string with an Empty character in C#.NET
I have a string like this:
string val = "123-12-1234";
How can I replace the dashes using an empty string in C#.
I mean val.Replace(char oldChar, newChar);
What needs to go in oldChar and newChar.
128
votes
10
answers
487k
views
How does one represent the empty char?
I'm currently writing a little program but I keep getting this error when compiling
error: empty character constant
I realize it's because I'm trying to replace a valid char with empty space c[i]='' ...
14
votes
5
answers
1k
views
Remove chars from string
I have a string like
string Text = "012345678901234567890123456789";
and a List<int> with indexes
List<int> Indexes = new List<int>() { 2, 4, 7, 9, 15, 18, 23, 10, 1, 2, 15, 40 };
...
5
votes
6
answers
29k
views
how to set a value of char array to null?
for example when I wrote:
Char[] test = new Char[3] {a,b,c};
test[2] = null;
it says Cannot convert null to 'char' because it is a non-nullable value type
if I need to empty that array of char, is ...
2
votes
2
answers
4k
views
yield return empty character literal
I'm writing a Linq extension method, to make a p455w0rd from a string input.
public static IEnumerable<char> ToPasswordFormat(this IEnumerable<char> source)
{
var enumerator = ...
4
votes
3
answers
12k
views
Why is there no empty char literal?
Is there any specific reason why there is no empty char literal?
What comes closest to what I think of, the '' is the '\0' the null character.
In C++ the char is represented by an int, which means ...
3
votes
4
answers
480
views
What is the difference between "" and " ", and how do I test the former in terms of a char?
In Java, what is the difference between "" (empty quotes) and " " (quotes with a single space) and how do I test the former in terms of a char?
5
votes
2
answers
355
views
Is there a reason '\0' is not supported in F#?
When I try to use '\0' as a character in F# it doesn't work. Here is what I see:
I have read elsewhere that Char.MinValue will accomplish the same thing though.
Is there any reason why '\0' is not ...
2
votes
3
answers
4k
views
How to initlize char to empty character in VB.NET
I am trying to assign empty char using
Private m_ClientAreaCode As Char = ''
But I am not able to assign.
1
vote
3
answers
599
views
Why replace invalid chars in a file name with '\0'?
i stumbled upon this bit here in a project from a colleague:
foreach (var invalidChar in Path.GetInvalidFileNameChars())
fileName = fileName.Replace(invalidChar, '\0');
the gerenal idea is ...
1
vote
3
answers
2k
views
C# strings with embedded null characters: bug, bad practice, or vulnerability?
I have re-coded to avoid embedded null characters in C# strings,... but was wondering why the following calls gave no warning or exception for string parameters with an embedded null character, and ...
1
vote
2
answers
994
views
Stripping Character From String
I have a code which sends a POST request to a web application and parses the response.
I'm sending the request with following code:
byte[] responseBytes = webClient.UploadValues("https://example....
-1
votes
2
answers
1k
views
Remove slashes from date and file extension from string
I need to do two things with strings:
A. Remove the file extension
B. Remove the '-' from the dates.
An example of an uploaded string is:
ifrs_au-cor_2013-03-12.xsd
I can't just do a replace on '-' ...
0
votes
1
answer
433
views
What is the intent of this string.Split() line?
What is the equivalent of this line in C#?
// In Java:
string[] split = val.Split("\u0000");
I know that:
The Java split function takes a regular expression.
"\u0000" is the null character in Java.
...