0

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.

4
Contributors
6
Replies
8
Views
5 Years
Discussion Span
Last Post by abhimanipal
0

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.

Edited by makman99: n/a

0

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.

0

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

0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.