Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

string manipulation

Posted on 2007-11-25
9
Medium Priority
?
259 Views
Last Modified: 2010-04-15
hi,

i need to write a function in c# that get a string like that "hello world"
and returns the all letters combination for eich word in the input string , for example:
"holle wlord"
"ohlel world"
"leloh oldw"
exc..

thanks.
0
Comment
Question by:bwz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 3
9 Comments
 
LVL 29

Accepted Solution

by:
Göran Andersson earned 40 total points
ID: 20346935
0
 
LVL 3

Expert Comment

by:Aurora27
ID: 20348187
just write a loop to replace each letter in the next position...and then loop for string's length
0
 
LVL 3

Expert Comment

by:Aurora27
ID: 20348188
Is there a pattern required?

CT.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:bwz
ID: 20348518
there is a case for pattern , but i dont want it be to much complicated
0
 
LVL 29

Expert Comment

by:Göran Andersson
ID: 20348630
Just split the string into words:

string word[] = input.Split(' ');

and get the permutations for each word.

Do you want the permuations for each word (i.e. for the example 120+120 combinations), or do you want all combinations of all permutations of all words (120*120 combinations)?
0
 

Author Comment

by:bwz
ID: 20348639
i the combination for each word and not for all the letters in the string
0
 
LVL 29

Expert Comment

by:Göran Andersson
ID: 20348734
Yes, but do you want the permuations for each word separately, or all combinations of all permuatations?

I.e. for "ab cde", do you want:

ab, ba
cde, ced, dce, dec, ecd, edc

or

ab cde
ab ced
ab dce
ab dec
ab ecd
ab edc
ba cde
ba ced
ba dce
ba dec
ba ecd
ba edc

For the first, just loop through the words and get the permuations. For the second you would create a list for each word that contains the permutations, then use an array of indexes to loop through all combinations.
0
 
LVL 3

Expert Comment

by:Aurora27
ID: 20348738
Author, you need to be clear in your question. If thats a college assignment, then just post the question as is. we can look at it.

CT.
0
 

Author Comment

by:bwz
ID: 20348809
greenGhost:
i mean to your second option.

Aurora27:
it's not by written task that i got.. it's a task that i should prepare ASAP

0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question