sort string

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

    #1

    sort string

    I read a text file context into a string.
    It's a sentence. - "Good day."
    I would like to save it back to text file but as "Day good."

    Hrcko


  • Jon Skeet [C# MVP]

    #2
    Re: sort string

    On Oct 3, 11:06 am, "Hrvoje Voda" <hrvoje.vo...@z g.htnet.hrwrote :
    I read a text file context into a string.
    It's a sentence. - "Good day."
    I would like to save it back to text file but as "Day good."
    Another employment test question? If so, I seriously hope you don't
    get (correct) answers.

    Jon

    Comment

    • Graeme Bradbury

      #3
      Re: sort string

      Common, the first question was an aha!, this one is easy to solve.

      "Hrvoje Voda" <hrvoje.voda2@z g.htnet.hrwrote in message
      news:fdvpjk$5p2 $1@ss408.t-com.hr...
      >I read a text file context into a string.
      It's a sentence. - "Good day."
      I would like to save it back to text file but as "Day good."
      >
      Hrcko
      >

      Comment

      • Hrvoje Voda

        #4
        Re: sort string

        I hope you don't speak with others in this way!

        Hrcko


        "Jon Skeet [C# MVP]" <skeet@pobox.co mwrote in message
        news:1191407156 .852618.297530@ n39g2000hsh.goo glegroups.com.. .
        On Oct 3, 11:06 am, "Hrvoje Voda" <hrvoje.vo...@z g.htnet.hrwrote :
        >I read a text file context into a string.
        >It's a sentence. - "Good day."
        >I would like to save it back to text file but as "Day good."
        >
        Another employment test question? If so, I seriously hope you don't
        get (correct) answers.
        >
        Jon
        >

        Comment

        • Kevin Spencer

          #5
          Re: sort string

          Create an array of strings from the string, sort the array, and create a
          string from the array.

          --
          HTH,

          Kevin Spencer
          Microsoft MVP

          DSI PrintManager, Miradyne Component Libraries:


          "Hrvoje Voda" <hrvoje.voda2@z g.htnet.hrwrote in message
          news:fdvpjk$5p2 $1@ss408.t-com.hr...
          >I read a text file context into a string.
          It's a sentence. - "Good day."
          I would like to save it back to text file but as "Day good."
          >
          Hrcko
          >

          Comment

          • Peter Duniho

            #6
            Re: sort string

            Hrvoje Voda wrote:
            I hope you don't speak with others in this way!
            And we hope you find that it's better to learn the material rather than
            having others take your interview tests for you. Will our hopes and
            desires be fulfilled? Only time will tell.

            Did it ever occur to you that if you have to ask other people for the
            answers to your interview questions, you may not be the person your
            prospective employer wants to hire?

            Whatever you think of the interview practice of asking such questions,
            clearly the employer in questions finds it of value. They are looking
            for a specific kind of candidate, and you can't change yourself into
            that kind of candidate just by asking people in this newsgroup to answer
            the questions for you.

            Unless your prospective employer is specifically looking for a person
            who will delegate the answering of interview questions to others, it
            seems like you're going about this in the wrong way.

            Pete

            Comment

            • Ben Voigt [C++ MVP]

              #7
              Re: sort string


              "Hrvoje Voda" <hrvoje.voda2@z g.htnet.hrwrote in message
              news:fdvt2e$grj $1@ss408.t-com.hr...
              >I hope you don't speak with others in this way!
              >
              Hrcko
              >
              Jon is one of the most well-spoken individuals in this group. If you find
              him offensive, then either you misunderstood him or you have a guilt
              complex. Because you replied and didn't deny that it is an interview
              question, I suspect the latter.


              Comment

              • Bill Butler

                #8
                Re: sort string


                "Hrvoje Voda" <hrvoje.voda2@z g.htnet.hrwrote in message
                news:fdvpjk$5p2 $1@ss408.t-com.hr...
                >I read a text file context into a string.
                It's a sentence. - "Good day."
                I would like to save it back to text file but as "Day good."
                1. Since you know that the file contains the string "Good day.", just
                skip that step for efficiency.
                2 Write the following program
                public class Silly
                {
                static void Main()
                {
                System.Console. WriteLine("Day good.");
                }
                }

                3. Compile program
                4 Run as follows from the command line
                Silly Silly.out

                There, perfect.




                Comment

                Working...