gnu/usr.bin/perl/utf8.c
/*
=for apidoc is_ascii_string

Returns true if the first C<len> bytes of the string C<s> are the same whether
or not the string is encoded in UTF-8 (or UTF-EBCDIC on EBCDIC machines).  That
is, if they are invariant.  On ASCII-ish machines, only ASCII characters
fit this definition, hence the function's name.

If C<len> is 0, it will be calculated using C<strlen(s)>, (which means if you
use this option, that C<s> can't have embedded C<NUL> characters and has to
have a terminating C<NUL> byte).

See also L</is_utf8_string>(), L</is_utf8_string_loclen>(), and L</is_utf8_string_loc>().

=cut
*/
for apidoc is_ascii_string
Returns true if the first C bytes of the string C are the same whether
or not the string is encoded in UTF-8 (or UTF-EBCDIC on EBCDIC machines).  That
is, if they are invariant.  On ASCII-ish machines, only ASCII characters
fit this definition, hence the function's name.

If C is 0, it will be calculated using C, (which means if you
use this option, that C can't have embedded C characters and has to
have a terminating C byte).



cut
for apidoc is_ascii_string Returns true if the first C bytes of the string C are the same whether or not the string is encoded in UTF - 8 ( or UTF - EBCDIC on EBCDIC machines ) . That is if they are invariant . On ASCII - ish machines only ASCII characters fit this definition hence the function ' s name . If C is 0 it will be calculated using C ( which means if you use this option that C can ' t have embedded C characters and has to have a terminating C byte ) . cut
bool
Perl_is_ascii_string(const U8 *s, STRLEN len)
{
    const U8* const send = s + (len ? len : strlen((const char *)s));
    const U8* x = s;
    PERL_ARGS_ASSERT_IS_ASCII_STRING;
    for (; x < send; ++x) {
	if (!UTF8_IS_INVARIANT(*x))
	    break;
    }
    return x == send;
}
bool Perl_is_ascii_string ( const U8 * s , STRLEN len ) { const U8 * const send = s + ( len ? len : strlen ( ( const char * ) s ) ) ; const U8 * x = s ; PERL_ARGS_ASSERT_IS_ASCII_STRING ; for ( ; x < send ; ++ x ) { if ( ! UTF8_IS_INVARIANT ( * x ) ) break ; } return x == send ; }
for apidoc is_ascii_string
Returns true if the first C<len> bytes of the string C<s> are the same whether
or not the string is encoded in UTF-8 (or UTF-EBCDIC on EBCDIC machines).
for apidoc is_ascii_string Returns true if the first C<len > bytes of the string C<s > are the same whether or not the string is encoded in UTF - 8 ( or UTF - EBCDIC on EBCDIC machines ) .