The Daily Click ::. Forums ::. Klik Coding Help ::. Can you search a string for an empty line?
 

Post Reply  Post Oekaki 
 

Posted By Message

Chris Burrows



Registered
  14/09/2002
Points
  2396

GOTW WINNER OCT. 2011
30th August, 2011 at 21:02:25 -


Is it possible to search a string for an empty line? And return a true or false value?

Example 1 (has empty line):

"HELLO MY
NAME

IS CHRIS"


Example 2 (does NOT have empty line):

"HELLO MY
NAME
IS CHRIS"

 
n/a

UrbanMonk

BRING BACK MITCH

Registered
  07/07/2008
Points
  49667

Has Donated, Thank You!Little Pirate!ARGH SignKliktober Special Award TagPicture Me This Round 33 Winner!The Outlaw!VIP MemberHasslevania 2!I am an April FoolKitty
Picture Me This Round 32 Winner!Picture Me This Round 42 Winner!Picture Me This Round 44 Winner!Picture Me This Round 53 Winner!
30th August, 2011 at 22:37:33 -

Yes it is.

Use:

-Find(string$( "String" ), NewLine$+NewLine$, 0)

Where "string$("String")" is the string you're testing.

It will return -1 if there are no empty lines.


However this method only detects empty lines within the content.
To detect a empty line on the end of the string:

-Compare two general values
right$(string$("String"),1) <> newline$


Edited by UrbanMonk

 
n/a

Chris Burrows



Registered
  14/09/2002
Points
  2396

GOTW WINNER OCT. 2011
31st August, 2011 at 03:55:15 -

Thanks UrbanMonk!

I've been experimenting and it seems Find(string$( "String" ),"your search here" , 0) will return the character value.

For example, here is a string:

Handgun Bullets
Lighter
Instant Coffee


Find(string$( "String" ), "Lighter", 0) will return a value of 17. The word "Lighter" begins at the 17th character in the string.

Is it possible to retrieve a line number instead?

 
n/a
   

Post Reply



 



Advertisement

Worth A Click