I've searched high and low for the answer to this but am unable to find a decent answer. The problem is simple, however, I am not a C programmer and its giving me migrane on how to do this.
What I want to achive is simple:
- I have a string, within, serveral lines of texts.
- I need to find out, if the last character in the entire text is a newline.
- if so, i need to add a string starting without a newline
- of not, i need to add a string starting with a newline.
I cannot seem to find a manner in how to verify the last character is newline or not. Remeber, the might be several newlines in the text present, I'm only intrested in the last newline.
If anyone has any thoughts on this I would really appreciate it!