Compiled as Algol 68 using Algol 68 Genie 2.8.3

is_vowel_asc_eng

Return true if input is an ASCII English vowel character.

@param CHAR chr A character.
@return BOOL A boolean value.

STRING vowel_asc_eng = "aeiouAEIOU";

PROC is_vowel_asc_eng = (CHAR chr) BOOL: (
    INT p;
    char in string(chr, p, vowel_asc_eng)
);

last_nonblank

Return last nonblank character of a string.

@param STRING str A string.
@return CHAR The last nonblank character of the string.

PROC last_nonblank = (STRING str) CHAR: (
    INT i := 0;
    WHILE str[UPB str - i] = blank DO
        i +:= 1
    OD;
    str[UPB str - i]
);

string_trim

Trim leading and trailing whitespace from string.

@param STRING str A string.
@return STRING A string trimmed of leading and trailing white space.

PROC string_trim = (STRING str) STRING: (
    INT i := 1, j := 0;
    WHILE str[i] = blank DO
        i +:= 1
    OD;
    WHILE str[UPB str - j] = blank DO
        j +:= 1
    OD;
    str[i:UPB str - j]
);