N
N
NQUARE2020-11-30 15:41:47
C++ / C#
NQUARE, 2020-11-30 15:41:47

What does this structure mean?

Can you please explain what these lines of code mean.

struct chcp1251 {
    static bool is_alpha(char ch) {
        return (ch >= -64 && ch <= -1)
            || ch == -88
            || ch == -72
            || (ch >= 65 && ch <= 90)
            || (ch >= 97 && ch <= 122);
    }
    static bool is_digit(char ch) {
        return ch >= 48 && ch <= 57;
    }
};

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vasily Bannikov, 2020-11-30
@NQUARE

Just some set of helpers for checking if characters belong to ranges.
chcp1251 - the name is shit. mk refers to chcp , but does not change the encoding.
1251 - reference to win1251
encoding is_alpha - checks if a character is a letter
is_digit - checks if a character is a digit

G
galaxy, 2020-11-30
@galaxy

Class (ok, structure) with methods for checking the type of a character in 1251 encoding (is_aplha - is it a letter, is_digit - a digit).
C++ looks like

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question