Thread: string manipulation

  1. #1
    Registered User
    Join Date
    Apr 2002
    Posts
    2

    string manipulation

    I'm writing a translator program, and I'm confused about a certain part. The project description asks for you to sometimes take a char and turn it into something that has more than one letter. what's an easy way to do this since I already use strchr() to find the letter. Replacing it with one letter is no prob, but trying to change the one char into multiple letters...I'm wracking my brain and can't think of a solution.
    Any help is greatly appreciated.

    Doug

  2. #2
    Unregistered
    Guest
    you could switch it:

    char letter;

    while( letter != '.' )
    {
    switch( letter )
    {
    case 'a':
    case 'A':
    cout << "aa"; //or whatever you want to do with it
    break;
    .
    .
    .
    .
    }
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C++ ini file reader problems
    By guitarist809 in forum C++ Programming
    Replies: 7
    Last Post: 09-04-2008, 06:02 AM
  2. Compile Error that i dont understand
    By bobthebullet990 in forum C++ Programming
    Replies: 5
    Last Post: 05-05-2006, 09:19 AM
  3. Replies: 4
    Last Post: 03-03-2006, 02:11 AM
  4. Linked List Help
    By CJ7Mudrover in forum C Programming
    Replies: 9
    Last Post: 03-10-2004, 10:33 PM
  5. string manipulation
    By SPEKTRUM in forum Linux Programming
    Replies: 3
    Last Post: 01-26-2002, 11:41 AM