473,399 Members | 2,146 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

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
Oct 3 '07 #1
7 1706
On Oct 3, 11:06 am, "Hrvoje Voda" <hrvoje.vo...@zg.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

Oct 3 '07 #2
Common, the first question was an aha!, this one is easy to solve.

"Hrvoje Voda" <hr**********@zg.htnet.hrwrote in message
news:fd**********@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
Oct 3 '07 #3
I hope you don't speak with others in this way!

Hrcko
"Jon Skeet [C# MVP]" <sk***@pobox.comwrote in message
news:11**********************@n39g2000hsh.googlegr oups.com...
On Oct 3, 11:06 am, "Hrvoje Voda" <hrvoje.vo...@zg.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

Oct 3 '07 #4
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:
http://www.miradyne.net

"Hrvoje Voda" <hr**********@zg.htnet.hrwrote in message
news:fd**********@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

Oct 3 '07 #5
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
Oct 3 '07 #6

"Hrvoje Voda" <hr**********@zg.htnet.hrwrote in message
news:fd**********@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.
Oct 3 '07 #7

"Hrvoje Voda" <hr**********@zg.htnet.hrwrote in message
news:fd**********@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.


Oct 4 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: its me | last post by:
Let's say I have a class of people... Public Class People Public Sex as String Public Age as int Public Name as string end class And I declare an array of this class...
5
by: Dr. Ann Huxtable | last post by:
Hello All, I am reading a CSV (comma seperated value) file into a 2D array. I want to be able to sort multiple columns (ala Excel), so I know for starters, I cant be using the array, I need...
9
by: Steve Wasser | last post by:
I need to sort a two-dimensional array. Each day I process a file with 9 comma-delimited fields, and varying amount of records (lines). I want to pull in each line, split it according to the comma...
1
by: Gunjan Garg | last post by:
Hello All, I am working to create a generic datagrid which accepts a datasource(ListData - This is our own datatype) and depending on the calling program customizes itself for sorting,...
3
by: Adam J. Schaff | last post by:
Hello. I recently noticed that the Sort method of the .NET ArrayList class does not behave as I expected. I expect 'A' < '_' < 'a' (as per their ascii values) but what I got was the opposite....
21
by: yeti349 | last post by:
Hi, I'm using the following code to retrieve data from an xml file and populate a javascript array. The data is then displayed in html table form. I would like to then be able to sort by each...
48
by: Alex Chudnovsky | last post by:
I have come across with what appears to be a significant performance bug in ..NET 2.0 ArrayList.Sort method when compared with Array.Sort on the same data. Same data on the same CPU gets sorted a...
3
by: micklee74 | last post by:
hi I have a file with columns delimited by '~' like this: 1SOME STRING ~ABC~12311232432D~20060401~00000000 2SOME STRING ~DEF~13534534543C~20060401~00000000 3SOME STRING ...
14
by: william.hooper | last post by:
There is a longer article about this subject here: http://www.codeproject.com/useritems/SortedList_Bug.asp See the main article and the reply thread started by Robert Rohde. Alternatively look...
3
by: raylopez99 | last post by:
This is an example of using multiple comparison criteria for IComparer/ Compare/CompareTo for List<and Array. Adapted from David Hayden's tutorial found on the net, but he used ArrayList so the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.