-
Notifications
You must be signed in to change notification settings - Fork 193
Open
Labels
implementationImplementation in experimental and submission of a PRImplementation in experimental and submission of a PRtopic: stringsString processingString processing
Description
While having a quick look at the documentation, I stumbled upon the implementation of the ASCII functions. For instance:
pure logical function is_alpha(c) character(len=1), intent(in) :: c !! The character to test. is_alpha = (c >= 'A' .and. c <= 'Z') .or. (c >= 'a' .and. c <= 'z') end function
The implementation assumes that the character that is passed is in ASCII encoding. While ubiquitous nowadays, it is certainly not the only possible encoding. For stdlib we should be as general as possible, Here is a possible alternative for the is_alpha() function:
pure logical function is_alpha(cin)
character(len=1), intent(in) :: cin !! The character to test.
integer :: c
c = iachar(cin)
is_alpha = (c >= iachar('A') .and. c <= iachar('Z')) .or. (c >= iachar('a') .and. c <= iachar('z'))
end function
Metadata
Metadata
Assignees
Labels
implementationImplementation in experimental and submission of a PRImplementation in experimental and submission of a PRtopic: stringsString processingString processing