Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

library(charsio): add to_upper and to_lower #1789

Merged
merged 1 commit into from
Apr 20, 2023
Merged

Conversation

aarroyoc
Copy link
Contributor

It adds uppercase and lowercase transformations based on #748

?- use_module(library(charsio)).
   true.
?- char_type(x, Type).
   Type = alnum
;  Type = alpha
;  Type = alphabetic
;  Type = alphanumeric
;  Type = ascii
;  Type = ascii_graphic
;  Type = lower
;  Type = octet
;  Type = prolog
;  Type = symbolic_hexadecimal
;  Type = to_lower("x")
;  Type = to_upper("X")
;  false.
?- char_type('ß', Type).
   Type = alnum
;  Type = alpha
;  Type = alphabetic
;  Type = alphanumeric
;  Type = lower
;  Type = octet
;  Type = prolog
;  Type = to_lower("ß")
;  Type = to_upper("SS")
;  false.
?- char_type('X', Type).
   Type = alnum
;  Type = alpha
;  Type = alphabetic
;  Type = alphanumeric
;  Type = ascii
;  Type = ascii_graphic
;  Type = octet
;  Type = prolog
;  Type = to_lower("x")
;  Type = to_upper("X")
;  Type = upper
;  false. 

The transformations use strings as the Rust API returns a string for the uppercase or lowercase of a single char. Of course, if you're using a language when this doesn't happen, you can always use:

?- char_type('X', to_upper([Upper])).
   Upper = 'X'.

@mthom mthom merged commit 3965281 into mthom:master Apr 20, 2023
@aarroyoc aarroyoc deleted the uppercase branch April 20, 2023 08:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants