|
Trim removes occurrences only at the begin or at the end of the string (MSDN):
String.Trim (Char[])
Removes all occurrences of a set of characters specified in an array from
the beginning and end of this instance.
|
|
|
|
|
I have got it,Thank you! I'm a new learner on C#.I come from china.Would you mind to make friends with me? I would like that you can help to improve my english and my C#.And if you want to make a journey to china,I can be you guide. MSN:wanlim0817@hotmail.com
email:wanlim0817@yahoo.com.cn
|
|
|
|
|
I wiil be happy to be your friend. On the other hand, since I'm Italian, English is not my native language. Moreover I'm not that C# expertise (C++ is my native programming language...). Anyway I will happy to receive your questions...
|
|
|
|
|
I think you're looking for .Replace. You can replace T with an empty string.
Christian Graus - C++ MVP
|
|
|
|
|
I have got it,Thank you! I'm a new learner on C#.I come from china.Would you mind to make friends with me? I would like that you can help to improve my english and my C#.And if you want to make a journey to china,I can be you guide. MSN:wanlim0817@hotmail.com
email:wanlim0817@yahoo.com.cn
|
|
|
|
|
you can use string builder or you can use the replace function it will repalce the letter T with an empt space
venu gopal
|
|
|
|
|
|
"exit while;"
Ooops -VB.Net only...Last modified: 4mins after originally posted -- correction
|
|
|
|
|
I could certainly be missing something but I thought this was for VB not C#.
only two letters away from being an asset
|
|
|
|
|
There's an exit keyword in C#?
|
|
|
|
|
It's from C# language specification:
When multiple switch, while, do, for, or foreach statements are nested within each other, a break statement applies only to the innermost statement. To transfer control across multiple nesting levels, a goto statement (§8.9.3) must be used.
using System;
class Test
{
static void Main(string[] args) {
string[,] table = {
{"Red", "Blue", "Green"},
{"Monday", "Wednesday", "Friday"}
};
foreach (string str in args) {
int row, colm;
for (row = 0; row <= 1; ++row)
for (colm = 0; colm <= 2; ++colm)
if (str == table[row,colm])
goto done;
Console.WriteLine("{0} not found", str);
continue;
done:
Console.WriteLine("Found {0} at [{1}][{2}]", str, row, colm);
}
}
}
|
|
|
|
|
Ahhhh! Not the notorious goto!
|
|
|
|
|
Well, I don't much like goto myself but that's the way Microsoft specifications provide. The good thing is that at least all finally blocks are still processed so not much harm is done. Sometimes goto is far more comprehensive than additional boolean flags and checks in nested loops.
|
|
|
|
|
It's not notorious when used to branch to the end of a block. In fact, that's what break and return do.
Djikstra's paper has to do with branching into a control block, there making program verification orders of magnitude more difficult.
/ravi
|
|
|
|
|
Richard Hartness wrote: ase statements are terminated with the C# keyword break. Unde
I guess you could have a boolean flag as part of the while loop, bool isBreakingFromDefault, and just set that flag to true when you break from default. When the while loop sees that flag as true, break from the while loop as well.
FWIW, I think the switch construct is butt ugly and often confusing. I'd much rather see a few if/elses.
|
|
|
|
|
Judah Himango wrote:
FWIW, I think the switch construct is butt ugly and often confusing. I'd much rather see a few if/elses.
Wow - I think the reverse. They are, of course, the same thing in the end.
Christian Graus - C++ MVP
|
|
|
|
|
Judah Himango wrote: I think the switch construct is butt ugly and often confusing. I'd much rather see a few if/elses.
the switch is excellent, but not really usable in every case, but so are if/elses. Just use the right tool for the job .
|
|
|
|
|
Even though you already mentioned this, it's short, and pretty much the standard:
bool bContinue = true;
while( myOtherCriteria && bContinue)
{
case...
...
...
otherwise:
bContinue = false;
}
|
|
|
|
|
To be weirder, you can throw an exception...
|
|
|
|
|
Richard Hartness wrote: C# seems to break down a little.
Actually, I don't think this has anything to do with C# per se. C and C++ work the same way.
/ravi
|
|
|
|
|
|
Richard Hartness wrote: awesome New Years resolution
Sadly, yet to be realized.
/ravi
|
|
|
|
|
Hi,
I have a typed dataset which I bind a DataGridView to, and I have set the caption property of the columns in my dataset.
However, when binded, the datagridview is showing the ColumnName value, not the Caption.
Am I doing something wrong? I thought that setting Caption would make the DataGridView use it.
Sorry if this has been asked before, search didnt yield any results
|
|
|
|
|
Try setting each columns header text in the DataGridView properties.
led mike
|
|
|
|
|
So, you've created the columns, and not AutoGenerated them?
|
|
|
|