Ez egy nagyon egyszeru függvény, a visszatérési érték igaz lesz, ha a megadott karakterláncunkban csak szóközök szerepelnek, vagy akkor is, ha a karakterlánc üres( nem tartalmaz karaktert ). Ez hasznos lehet például jelszók ellenorzésénél, vagy akármilyen más értékkezelésnél.
stock bool: strisspace( string[ ] ) {
static spaces, index;
for( index = 0; index < strlen( string ); ++index ) if( string[ index ] == \' \' ) ++spaces;
if( spaces == strlen( string ) ) return true;
return false;
}
ZeRo
A tiedre a fordító egy figyelmeztetést ír:
warning 208: function with tag result used before definition, forcing reparse[/quote]
Én így oldanám meg: :D
bool: strisspace( string[ ] )
{
for( new index = 0; index < strlen( string ); ++index ) if( string[ index ] != \' \' ) return false;
return true;
}