Results 1 to 2 of 2
Thread: convert 2 characters
Aug 2, 2010, 04:54 #1
- Join Date
- Aug 2010
- 0 Post(s)
- 0 Thread(s)
convert 2 characters
I would like to create a program which converts some letters into different ones. Here is the idea.
1) I want 2 text areas (input and output) + "convert" button
2) if I type in the input area the letters "ea" I would like it to be converted into "a", so that If I type "cambrea" and press "submit" the output text will have "cambra".
3) if I type "e " which is (e+space) I want it to be converted into " " which is "space" example: if I type the word "spine " it should be converted into "spin , note that there is a space after "spin ".
4) If I type any vowel before "o" it should render "o", example: gambuo becomes gambo.
Aug 2, 2010, 19:29 #2
- Join Date
- Jan 2007
- Christchurch, New Zealand
- 61 Post(s)
- 3 Thread(s)
Regular expressions are possibly what you're after.
You can then use a regular expression with the the replace method to achieve the replacements that you're after. You can also use straight string replacement too.
Is this for a course that you're taking? Or is there some data-set that needs to be converted. If the latter, we should be able to help you find pre-existing solutions that already exist in the wild.Programming Group Advisor
The 2013 SitePoint Awards - Nominate your heroes now!