30.5 IsString

IsString( obj )

IsString returns true if the object obj, which may be an object of arbitrary type, is a string and false otherwise. Will cause an error if obj is an unbound variable.

    gap> IsString( "Hello world.\n" );
    true
    gap> IsString( "123" );
    true
    gap> IsString( 123 );
    false
    gap> IsString( [ '1', '2', '3' ] );
    true
    gap> IsString( [ '1', '2', , '4' ] );
    false    # strings must be dense
    gap> IsString( [ '1', '2', 3 ] );
    false    # strings must only contain characters 

Previous Up Top Next
Index

GAP 3.4.4
April 1997