F_IS_WHITE_SPACE

///////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Function Name : f_is_white_space
// Argument Name : as_source, Arg Type : String, Pass By : Value
// Return Type :      Boolean
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
//    Description:   Determines whether a string contains only White Space
//                        characters. White Space characters include Newline, Tab,
//                        Vertical tab, Carriage return, Formfeed, and Backspace.
///////////////////////////////////////////////////////////////////////////////////////////////////////////////

Long       ll_count=0
Long       ll_length
Char       lc_char[]
Integer    li_ascii

//Check parameters
If IsNull(as_source) Then
    boolean lb_null
    SetNull(lb_null)
    Return lb_null
End If

//Get the length
ll_length = Len (as_source)

//Check for at least one character
If ll_length=0 Then
    Return False
End If

//Move string into array of chars
lc_char = as_source

//Perform loop around all characters
//Quit loop if Non WhiteSpace character is found
Do While ll_count < ll_length
    ll_count ++
   
    //Get ASC code of character.
    li_ascii = Asc (lc_char[ll_count])
   
    If li_ascii=8    Or            /* BackSpae */                 &
        li_ascii=9   Or            /* Tab */                     &
        li_ascii=10 Or            /* NewLine */                &
        li_ascii=11 Or            /* Vertical Tab */        &
        li_ascii=12 Or            /* Form Feed */            &
        li_ascii=13 Or            /* Carriage Return */    &
        li_ascii=32 Then        /* Space */       
        //Character is a WhiteSpace.
        //Continue with the next character.
    Else
        /* Character is Not a White Space. */
        Return False
    End If
Loop
   
// Entire string is White Space.
Return True

0 comments:

Post a Comment