Re: Where is string.Reverse() and string.SwapChars()?
- From: "Jonathan Wood" <jwood@xxxxxxxxxxxxxxxx>
- Date: Thu, 16 Nov 2006 12:20:45 -0700
Thanks but there are a few things like this that really irk me about C# and
..NET.
Why not add a Reverse method? It's very simple for Microsoft to do. On the
other hand, converting the string to an array, reversing it, and then
converting it back to a string requires additional memory allocations, etc.
that greatly reduce the efficiency of this simple task. If the language is
not going to allow us to perform certain tasks (such as swapping two
characters without create a new string), the least they could do is
implement a simple Reverse method.
I guess I'm having trouble with this overall mentality of limiting what we
can do, especially when simple functionality has not been included for us.
Must just be me.
--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com
"Michael Nemtsev" <nemtsev@xxxxxxx> wrote in message
news:1799a79b3beebd8c8d7d74ffa10a4@xxxxxxxxxxxxxxxxxxxxxxx
Hello Jonathan,
Reverse is the method of Array class, thus u can convert string to array
and reverse array
For swapping use String.Replace
JW> Is it just me? It seems like one moving from MFC to C# loses some
JW> string functionality such as the two mentioned in the subject.
JW> JW> Did I miss something?
JW> ---
WBR,
Michael Nemtsev [C# MVP] :: blog: http://spaces.live.com/laflour
"At times one remains faithful to a cause only because its opponents do
not cease to be insipid." (c) Friedrich Nietzsche
.
- References:
- Where is string.Reverse() and string.SwapChars()?
- From: Jonathan Wood
- Re: Where is string.Reverse() and string.SwapChars()?
- From: Michael Nemtsev
- Where is string.Reverse() and string.SwapChars()?
- Prev by Date: Re: VS2005 - 64bit - processor
- Next by Date: Re: Convert.ToString() Base Limitations
- Previous by thread: Re: Where is string.Reverse() and string.SwapChars()?
- Next by thread: Re: Where is string.Reverse() and string.SwapChars()?
- Index(es):
Relevant Pages
|