AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Files: Deleting and check empty lines (https://forums.alliedmods.net/showthread.php?t=28425)

Cheap_Suit 05-14-2006 13:55

Files: Deleting and check empty lines
 
First can you delete an empty line?

Code:
test0 test1 test2
to
Code:
test0 test1 test2

Second, how do you check for an emtpy line?

Twilight Suzuka 05-14-2006 13:57

Short answer: You can't.
Long answer: You can, using Stream module, or the raw data mode of the new writing functions.

Checking for an empty line is as easy as simply checking to see if it equals ""

Greenberet 05-14-2006 13:59

Quote:

Originally Posted by Twilight Suzuka
Checking for an empty line is as easy as simply checking to see if it equals ""

"^n" or "^r^n"

Twilight Suzuka 05-14-2006 14:11

NO GREENBERET, BACK IN YOUR CAGE!

If you use the read_file native, its just "". If you use the others, it is ^n.

Greenberet 05-14-2006 14:27

read_file yes
other method is "^n" or "^r^n"
depends on the programm who created the file.
eg. the standart text editor from MS is using "^r^n"

btw. i dont like the cage

Twilight Suzuka 05-14-2006 14:29

Yeah,t hats why we shove you in it. So you don't ask for more natives. XD

Cheap_Suit 05-14-2006 21:40

Quote:

Originally Posted by Twilight Suzuka
Short answer: You can't.
Long answer: You can, using Stream module, or the raw data mode of the new writing functions.

Checking for an empty line is as easy as simply checking to see if it equals ""

I see. Thanks :)

Xanimos 05-14-2006 22:24

Or you could read a file write the lines you want to a temp file then delete the first file and rename the temp to the correct name

Urahara 05-14-2006 23:26

Ohayo Renji-san! :D
That is a horrible horrible way to do it ^^ *flicks fan*

Xanimos 05-14-2006 23:54

I never ever said it was efficient.
Possibly make a native for this?


All times are GMT -4. The time now is 16:33.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.