Replace letter with any other letter (inputted from user) in a long paragraph

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Chirayu
    New Member
    • Oct 2007
    • 3

    Replace letter with any other letter (inputted from user) in a long paragraph

    Hello

    I have started doing a new project & im having problems. My program should be able to take input from user- the text they want to decode. Then the user should input what letters they want to replace each of the letters by. for e.g. 'a' for 't', 'y' for 'k' etc.

    The program should then display the decoded or the fully replaced text in a label or a textbox or any other control.

    Thank you. HELP IS URGENT!!!
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    Try writing a simple function using REPLACE Function.

    Comment

    • Chirayu
      New Member
      • Oct 2007
      • 3

      #3
      Can you tell me exactly how do I use the replace function. I am taking the input in a text box from the user. Then in 26 other text boxes they would type the letters they want each of the letter to be replaced by.

      Pls suggest in detail how to use replace function in this context and does this have anything to do with Formatting of string? If so, please tel me how to use it.

      Many Thanks.

      Comment

      • Killer42
        Recognized Expert Expert
        • Oct 2006
        • 8429

        #4
        You could place each of the "from" characters and each of the "to" characters in two arrays. Then set up a For loop to go through and plug each pair into the Replace() function to make a switch.

        Or you could simply loop through each character in the string and check each of your 26 pairs individually to see whether you need to change that character. Once again, arrays will be very useful here. Without using an array, you will probably have to write the same code 26 times.

        You really should look up the documentation if you need to know the basic syntax to do these sort of things.

        Comment

        Working...