tolower

This is a discussion on tolower within the C++ Programming forums, part of the General Programming Boards category; I'm having trouble pulling each character out to change each one to a lowercase letter i.e. PAPER to paper...

  1. #1
    Registered User
    Join Date
    Jan 2002
    Posts
    4

    tolower

    I'm having trouble pulling each character out to change each one to a lowercase letter

    i.e. PAPER to paper

  2. #2
    Fingerstyle Guitarist taylorguitarman's Avatar
    Join Date
    Aug 2001
    Posts
    564
    Code:
    char Array[] = "PAPER";
    
    for(int i = 0; i < (int)strlen(Array); i++) {
     printf("%c", tolower(Array[i]));
    }
    you'll need <cstdio>, <cstdlib>, <cstring> or the equivilent for your compiler.
    Last edited by taylorguitarman; 02-06-2002 at 03:10 AM.

  3. #3
    Registered User
    Join Date
    Jan 2002
    Posts
    381
    c'mon this isn't hard:

    #include <iostream>
    using namespace std;

    int main()
    {
    char tolower[] = "PAPER";

    for (int i = 0; i < 5; i++)
    {
    tolower[i] |= 0x20;
    cout<<tolower[i];
    }

    return 0;
    }
    Last edited by shtarker; 02-07-2002 at 01:11 AM.

  4. #4
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,136
    Do u know of any good bit/hex operations tutorials on the net?

  5. #5
    Registered User
    Join Date
    Jan 2002
    Posts
    381
    For a really good explanation you should probbly read the first chapter of Art Of Assembly. It mainly just goes over all the basics of binary and hex. Kind of like the stuff you some times do in a general computing course, only in detail not just breezing over it.
    But i must say its not hard to understand how bit operations work. The tricky bit is knowing when to use them.

  6. #6
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,136
    thanx

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. tolower and locale
    By MK27 in forum C Programming
    Replies: 16
    Last Post: 02-03-2009, 08:05 PM
  2. tolower error
    By Livijn in forum C++ Programming
    Replies: 37
    Last Post: 05-31-2007, 11:37 PM
  3. tolower function problem
    By Jack-Bauer in forum C++ Programming
    Replies: 6
    Last Post: 05-18-2006, 11:17 PM
  4. how do you use tolower()
    By panfilero in forum C Programming
    Replies: 3
    Last Post: 11-03-2005, 12:18 PM
  5. Tolower
    By webren in forum C++ Programming
    Replies: 2
    Last Post: 04-09-2005, 08:17 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21