Re: [ADVANCED-DOTNET] Trim function in c#

2008-04-10 Thread Simon Robinson
Or, if you're not sure what's in the string, safer to say str = (str == null) ? null : str.Trim(); As an aside, I very rarely use Trim() because almost invariably what I want to do isn't simply trim a string, but do something more akin to XPath's normalize_space() function: remove all leading and

Re: [ADVANCED-DOTNET] Case sensitive dictionary

2008-04-10 Thread Greg Young
Oh I must have read the question wrong since thats the defailt :-) wouldn't expect someone to ask how. On Thu, Apr 10, 2008 at 4:54 PM, Marc Brooks <[EMAIL PROTECTED]> wrote: > > > I am looking for a case sensitive string- or generic dictionary, meaning > > > the > > > key should not automatica

Re: [ADVANCED-DOTNET] Trim function in c#

2008-04-10 Thread Peter Vertes
http://msdn2.microsoft.com/en-us/library/t97s7bs3.aspx Pretty straight forward: String myString = " Testing Testing 123 "; Console.WriteLine(myString.Trim()); This will produce "Testing Testing 123" (notice the lack of spaces before and after the string contents). There is also TrimEnd() an

Re: [ADVANCED-DOTNET] Trim function in c#

2008-04-10 Thread Marc Brooks
> Can anyone tell me how to use string function Trim in C#? The thing to remember is that string are immutable in C#/ .Net, so calling Trim against one doesn't change THAT string, it returns a NEW string... you want this: string foo = "Blah "; foo = foo.Trim(); -- "Your lack of planning DOES c

Re: [ADVANCED-DOTNET] Case sensitive dictionary

2008-04-10 Thread Marc Brooks
> > I am looking for a case sensitive string- or generic dictionary, meaning the > > key should not automatically be converted to lower case. > > Dictionary nodes = new Dictionary( > StringComparer.OrdinalIgnoreCase ) ? He want's sensitive, not insensitve: Dictionary nodes = new Dictionary(Strin

[ADVANCED-DOTNET] Trim function in c#

2008-04-10 Thread Tracy Ding
Can anyone tell me how to use string function Trim in C#? Sincerely, Tracy Ding XYPRO Technology USA HQ phone: +1-805-583-2874 === This list is hosted by DevelopMentorĀ® http://www.develop.com View archives and manage your subscription(s) at http://discuss.d

Re: [ADVANCED-DOTNET] Case sensitive dictionary

2008-04-10 Thread Greg Young
Dictionary nodes = new Dictionary( StringComparer.OrdinalIgnoreCase ) ? On Thu, Apr 10, 2008 at 2:28 PM, Robert Fuchs <[EMAIL PROTECTED]> wrote: > I am looking for a case sensitive string- or generic dictionary, meaning the > key should not automatically be converted to lower case. > > > > Any i

Re: [ADVANCED-DOTNET] Case sensitive dictionary

2008-04-10 Thread Barry Kelly
Robert Fuchs <[EMAIL PROTECTED]> wrote: > I am looking for a case sensitive string- or generic dictionary, meaning the > key should not automatically be converted to lower case. What's wrong with Dictionary? -- Barry -- http://barrkel.blogspot.com/ === This lis

[ADVANCED-DOTNET] Case sensitive dictionary

2008-04-10 Thread Robert Fuchs
I am looking for a case sensitive string- or generic dictionary, meaning the key should not automatically be converted to lower case. Any idea? Regards, Robert === This list is hosted by DevelopMentorĀ® http://www.develop.com View archives and manage your