Closed
Description
Not sure if this is a bug.
This seems intentional, but the ispunct
in julia is inconsistent with the behavior of the C function of the same name, which is confusing.
Perhaps a warning could be added to clarify the inconsistency with C.
https://en.cppreference.com/w/cpp/string/byte/ispunct
julia> c = '+'
'+': ASCII/Unicode U+002B (category Sm: Symbol, math)
julia> ispunct(c)
false
julia> ( @ccall ispunct(c::Cchar)::Cint ) != 0
true
julia> c = '-'
'-': ASCII/Unicode U+002D (category Pd: Punctuation, dash)
julia> (ispunct(c), ( @ccall ispunct(c::Cchar)::Cint )!= 0)
(true, true)
ispunct(c::AbstractChar) -> Bool
Tests whether a character belongs to the Unicode general category Punctuation, i.e. a character whose category code
begins with 'P'.
And more chars:
julia> for c in raw"""!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~"""
ispunct(c) || println(c)
end
$
+
<
=
>
^
`
|
~