![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: May 2005
Location: Charleston, SC
Posts: 11
Rep Power: 0
![]() |
change vowels to the letter x
I am trying to change vowel letters to the letter x and numbers to the letter z and revese the word and i am ready to throw the notebook across the room, please help......
if vowellabel.substring(indexnum,1) = vowel then mid(me.vowel.text) = vowel replaceX = true end if |
|
|
|
|
|
#2 |
|
Programming Guru
![]() ![]() ![]() |
Some things to look into:
1) For Each loops... 2) Char.IsDigit 3) Functions 4) Strings Here is some code for you to analyze. Let me know if you have specific questions. This probably isn't the best or easiest way to do this... but it works. I am going to leave the string reversal up to you, I suggest spending more time on this effort to better understand it.
Module Module1
Sub Main()
Dim myStr As String = "The answer is 42. Today is 6/17"
Dim c As Char = ""
Dim d As Char = ""
Dim temp As String = ""
For Each c In myStr
d = ChangeIt(c)
temp = String.Concat(temp, Convert.ToString(d))
Next
Console.WriteLine("Original: " + myStr)
Console.WriteLine("Modified: " + temp)
Console.WriteLine("done")
myStr = Console.ReadLine()
End Sub
Public Function ChangeIt(ByVal c As Char) As Char
Dim a As Char = ""
Dim vowel As String = "aeiouy"
If Char.IsDigit(c) Then
Return "z"
Else
For Each a In vowel
If Char.ToUpper(a) = Char.ToUpper(c) Then
Return "x"
End If
Next
End If
Return c
End Function
End Module I can't believe I just wrote code in VB... I feel sick. ;(
__________________
http://jasonpowers.net "There are a thousand hacking at the branches of evil to one who is striking at the root." |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| change vowels to X | boatn19 | Visual Basic | 6 | Jun 17th, 2007 10:37 PM |
| Sorting | taporctv | Java | 9 | Apr 15th, 2006 8:55 AM |
| How to search first letter in array | seaminem | PHP | 1 | Jan 30th, 2006 6:12 AM |
| [Python] Simple Hangman game | Jessehk | Show Off Your Open Source Projects | 5 | Jan 24th, 2006 8:36 AM |
| How can I change .asp page of frame after every 5-10 minutes ? | sham | ASP | 1 | May 1st, 2005 8:25 PM |