Ok in a simplex txt file i have some text written in all capital letters. Now i need to take that text convert it to lowercase and then ucfirst in this way.

Ex: MY NAME IS MIKE AND I GO TO LIBRARY EVERY DAY. I ALSO LIKE PIE.
Now i read files by lines so i first turn all those lowercase and then uppercase all first characters of each word.

Now here i my problem i only need to uppercase the first character if it is a start of the new line like at the beginning of the text or if its after ( . )

Also names need to start with a capital letter like Mike, but i can have all the names that are in the text preset in an array or a list.

So the Ex. above after editing should look like:

My name is Mike and i go to library every day. I also like pie.

Recommended Answers

All 6 Replies

split each line by space, into an array.
MY
NAME
IS
MIKE
etc..

Then do a foreach word, see if any of your names in your names array matches, and if so, make the first letter uppercase.

For periods, split the original line again by ". " and then make all the front chars in each sentence uppercase.

Can u follow up whit a code example

Can u follow up whit a code example

No. We won't write your code for you. As per the Member Rules you were supposed to read, you post code and we help you fix it.

Some of the functions you might need

strtok --> Use this function to split a string into a series of words
strcmp --> Check if this word is a name or a period

Some of the functions you might need

strtok --> Use this function to split a string into a series of words
strcmp --> Check if this word is a name or a period

Thanks that helped a lot

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.