String functions

Experts,
        I am just starting to explore into the STL library and had questions about some inbuilt functions.

(1) How do I convert all the characters in a string to lower-case.
(2) How do I remove blank lines between words in a string
(3) How do I convert 2 words (part of a string) which are both in small caps into one where the first character in each word has large caps.
gvijay1Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ArvindtnCommented:
Try this site, you will get a lot of information on STL.

http://www.dinkum.com/htm_stl/index.html


0
nietodCommented:
FYI The EE guidelines specifically state that you should ask only 1 question per question   (this is 3).  furthermore each of these questions are probalby worth 50 points, at least 30 points a piece.
0
sumant032199Commented:
You will need to include CTYPE.H in your program. I would suggest you to go through some funcions like tolower() toupper() in CTYPE.H, which can solve the problem. The answer to your 1st question is tolower() function.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

eugene007Commented:
1) islover()  
2) ispunct()
3) isupper()
4) isspace()
5) isdigit()
6) isalpha()


This are the character classification and conversion facilities in ctype library. In your case you could use the option 1,4,3. Its all up to you now to utilize this function. Please include the #include<ctype.h> header file in your program.


Regards

Eugene



0
gvijay1Author Commented:
Eugene,
       I tried isupper(string) and it does not work. I also tried string.isupper() and it also does not work. I have a feeling that this is part of c and not c++. Is there any function in C++ that can handle this conversion?

GVijay1
0
eugene007Commented:
#include <ctype.h>
#include <string.h>

void main(void)
{
    //You can place this coding
    //where ever you feel its right
    //to be placed. It does not always
    //have to reside in the place where
    //i have specified.

    char chStr[10] = "SE100";
    int k = strlen(chStr);
    for (int i = 0; i <= k ; i++)
    {
       if (isalpha(chStr[i]))
       {
          AfxMessageBox("Character");
       }
       else if(isalnum(chStr[i]))
       {
          AfxMessageBox("Number");
       }
    }
}


Try this program first in you visual c++ and let me know what is the result..:)


Regards

Eugene
0
gvijay1Author Commented:
expert,
      I finally got it to work..Thanks..
0
eugene007Commented:
cool..:)

Regards

Eugene
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C++

From novice to tech pro — start learning today.