Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27329

VS 2010 Check if line is empty or contains text.

$
0
0
I've been trying to find a solution myself before I post here but I couldn't find anything.

I have some text in a textbox. For example:

Quote:

Dear Tori.

Please check your email, I sent you the message.

Thanks.
[empty line here. vbforums deletes the empty spaces so i'm writing this instead].
Now, you can obviously see that after the "Thanks", I have an empty line. I want to create
a code to check if the last line is empty or not (Even spaces is considered empty). So, let's look at Text A and Text B.

Text A.

Quote:

Dear Tori.

Please check your email, I sent you the message.

Thanks.
[empty line here].
Text B.

Quote:

Dear Tori.

Please check your email, I sent you the message.

Thanks.
in Text B the last line is "Thanks". Therefore, it will add a new line after it saying "John.", for example.
in Text A the last line is " " (empty. there is a line, but it's empty. even if the line had 15 spaces, like
" ", it would be considered as empty). Then, it will overwrite that line and replace it with "John".

Thanks for any help.

Merry Christmas.

Viewing all articles
Browse latest Browse all 27329

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>