Re: Where is string.Reverse() and string.SwapChars()?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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




.



Relevant Pages

  • Re: Working with floating point numbers.
    ... mechanism but now need to reverse the situation and convert a double to the ... I have reversed the code but come stuck when I try to assign the array to ... I've tried to Asc) the string but it didn't work and when I ... Dim S As MyStrings ...
    (microsoft.public.access.modulesdaovba)
  • Re: Hi guys! Got stuck with this..
    ... Reverse this string to get it back into the correct direction. ... Split it at CRLF into an array. ... You could keep a rolling buffer of the previous 3 lines as variables ...
    (comp.lang.php)
  • Re: extract of an image (array)
    ... The code reads in a list of integers from the PGM file into an array ... convert the array of integers into a string s. ... subroutine that fails on other compilers. ... call ivec_to_s (nval, istring, string, reverse) ...
    (comp.lang.fortran)
  • Re: Reading text file in reverse order
    ... > array contains all lines in the file; each element in the array is a ... > characters into an array so you can reverse them. ... > to break a string into an array of characters, but ...
    (perl.beginners)
  • reverse a collection
    ... Array has a reverse method. ...
    (microsoft.public.dotnet.languages.vb)