473,322 Members | 1,699 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,322 software developers and data experts.

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
Nov 17 '05 #1
2 1032
nevermind i got it
"Jimmy" <be****@gmail.com> wrote in message
news:#s**************@TK2MSFTNGP10.phx.gbl...
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

Nov 17 '05 #2
On Sat, 21 May 2005 12:04:54 +1000, Jimmy wrote:
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?


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(ar);
string strR = string.Join(" ", ar);
--
Tom Porterfield
Nov 17 '05 #3

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

Similar topics

4
by: Keiron Waites | last post by:
I get the following error: Notice: Array to string conversion in C:\Documents and Settings\ShepMode\Desktop\Websites\ShareMonkey.net\Web\join.php on line 11 in this code: $input =...
10
by: Marcin Kalicinski | last post by:
Why string literals are regarded as char * not as const char *? (1) void f(char *); (2) void f(const char *); f("foo") will call version (1) of function f. I understand that the exact type...
52
by: junky_fellow | last post by:
char *str1 = "Hello"; char arr1 = { "Hello" }; char arr2 = { 'H', 'e', 'l', 'l', 'o' }; Is it legal to modify str1, arr1 and arr2 ?
26
by: junky_fellow | last post by:
Consider the following piece of code: char *str = "Hello"; if (str = "Hello") printf("\nstring matches\n"); str is pointer to char and "Hello" is a string literal whose type is "array of...
11
by: Zordiac | last post by:
How do I dynamically populate a string array? I hope there is something obvious that I'm missing here Option Strict On dim s() as string dim sTmp as string = "test" dim i as integer ...
18
by: Ger | last post by:
I have not been able to find a simple, straight forward Unicode to ASCII string conversion function in VB.Net. Is that because such a function does not exists or do I overlook it? I found...
5
by: Jamie Risk | last post by:
This is the code snippet that I've come up to convert a byte to string. Is there a best practiced method for such a conversion? - Jamie public static string ByteArrayToString(byte array) {...
21
by: phpCodeHead | last post by:
Code which should allow my constructor to accept arguments: <?php class Person { function __construct($name) { $this->name = $name; } function getName()
11
by: Sudzzz | last post by:
Hi, I'm trying to convert a string something like this "{201,23,240,56,23,45,34,23}" into an array in C++ Please help. Thanks, Sudzzz
4
by: vcnewbie | last post by:
Hi I'm maintaining a VisualC++ project to increase its security regarding stored passwords. I thought about using SHA256Managed to create a hash for the password when creating a user and when...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.