Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jun 17th, 2007, 4:41 PM   #1
boatn19
Newbie
 
Join Date: May 2005
Location: Charleston, SC
Posts: 11
Rep Power: 0 boatn19 is on a distinguished road
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
boatn19 is offline   Reply With Quote
Old Jun 17th, 2007, 10:27 PM   #2
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,453
Rep Power: 7 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
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."
Infinite Recursion is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 3:54 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC