PowerBuilder Function Is Punctuation gf_is_punctuation
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
///////////////////////////////////////////////////////////////////////////////////////////////////////////// // // Function Name : gf_is_punctuation // Argument Name : as_source, Arg Type : String, Pass By : Value // Return Type : Boolean /////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Description: Determines whether a string contains only punctuation // characters. /////////////////////////////////////////////////////////////////////////////////////////////////////////////// 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 Punctuation 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 = 33 Or /* '!' */ & li_ascii = 34 Or /* '"' */ & li_ascii = 39 Or /* ''' */ & li_ascii = 44 Or /* ',' */ & li_ascii = 46 Or /* '.' */ & li_ascii = 58 Or /* ':' */ & li_ascii = 59 Or /* ';' */ & li_ascii = 63 Then /* '?' */ //Character is a punctuation. //Continue with the next character. Else Return False End If Loop // Entire string is punctuation. Return True |
Good Luck!
Subscribe
Login
0 Comments
Oldest