string array conversion

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jimmy

    string array conversion

    Hi

    I want to write a program to reverse a string.For example :string
    stobereversed ="hello how are you"
    becomes :"you are how hello". What is the fastest and most elegant code for
    this?

    thanks

    Jim


  • Jimmy

    #2
    Re: string array conversion

    nevermind i got it
    "Jimmy" <beffer@gmail.c om> wrote in message
    news:#sJl8laXFH A.1044@TK2MSFTN GP10.phx.gbl...[color=blue]
    > Hi
    >
    > I want to write a program to reverse a string.For example :string
    > stobereversed ="hello how are you"
    > becomes :"you are how hello". What is the fastest and most elegant code[/color]
    for[color=blue]
    > this?
    >
    > thanks
    >
    > Jim
    >
    >[/color]


    Comment

    • Tom Porterfield

      #3
      Re: string array conversion

      On Sat, 21 May 2005 12:04:54 +1000, Jimmy wrote:
      [color=blue]
      > Hi
      >
      > I want to write a program to reverse a string.For example :string
      > stobereversed ="hello how are you"
      > becomes :"you are how hello". What is the fastest and most elegant code for
      > this?[/color]

      I don't know if it's the fastest and most elegant, but this will work:

      string str = "hello how are you";
      string [] ar = str.Split(' ');
      Array.Reverse(a r);
      string strR = string.Join(" ", ar);
      --
      Tom Porterfield

      Comment

      Working...