|
libft
|
Custom functions to classify characters or validate string content. More...
Files | |
| file | ft_check.h |
| Classification and validation functions for characters and strings. | |
| file | ft_is_valid_integer.c |
Validates whether a string represents a valid long long integer. | |
Functions | |
| bool | ft_is_valid_integer (const char *str) |
| Validates C-style signed integer string format. | |
| int | ft_isalnum (int c) |
| Alphanumeric character. | |
| int | ft_isalpha (int c) |
| Alphabetic character. | |
| int | ft_isascii (int c) |
| ASCII character (0–127) | |
| int | ft_isdigit (int c) |
| Decimal digit (0–9) | |
| int | ft_islower (int c) |
| Lowercase letter. | |
| int | ft_isprint (int c) |
| Printable character (including space) | |
| int | ft_ispunct (int c) |
| Printable non-alphanumeric (e.g., punctuation) | |
| int | ft_issign (int c) |
| '+' or '-' | |
| int | ft_isspace (int c) |
| Whitespace (space, tab, newline, etc.) | |
| bool | ft_isstrpositive (const char *str) |
| Checks if string contains only digits and is > 0. | |
| int | ft_isupper (int c) |
| Uppercase letter. | |
| static bool | is_in_longlong_range (const char *str, bool negative) |
Checks if a numeric string fits within the long long range. | |
Custom functions to classify characters or validate string content.
This group includes replacements and enhancements for standard <ctype.h> checks as well as boolean helpers to test string-wide properties (e.g., numeric strings, positivity).
This group includes:
| bool ft_is_valid_integer | ( | const char * | str | ) |
#include <include/ft_check.h>
Validates C-style signed integer string format.
Validates if a string represents a valid long long integer.
The string may start with a '+' or '-' sign, followed by decimal digits. The function rejects empty strings, non-digit characters, and any numeric values that would overflow a long long.
| str | Null-terminated string to validate. |
| int ft_isalnum | ( | int | c | ) |
#include <include/ft_check.h>
Alphanumeric character.
Checks if a character is alphanumeric.
| c | Character to check. |
| int ft_isalpha | ( | int | c | ) |
#include <include/ft_check.h>
Alphabetic character.
Checks if a character is an alphabetic letter.
| c | Character to check. |
| int ft_isascii | ( | int | c | ) |
#include <include/ft_check.h>
ASCII character (0–127)
Checks if a character is an ASCII character.
| c | Character to check. |
| int ft_isdigit | ( | int | c | ) |
#include <include/ft_check.h>
Decimal digit (0–9)
Checks if a character is a decimal digit.
| c | Character to check. |
| int ft_islower | ( | int | c | ) |
#include <include/ft_check.h>
Lowercase letter.
Checks if a character is lowercase.
| c | Character to check. |
| int ft_isprint | ( | int | c | ) |
#include <include/ft_check.h>
Printable character (including space)
Checks if a character is printable.
| c | Character to check. |
| int ft_ispunct | ( | int | c | ) |
#include <include/ft_check.h>
Printable non-alphanumeric (e.g., punctuation)
Checks if a character is a punctuation mark.
| c | Character to check. |
| int ft_issign | ( | int | c | ) |
#include <include/ft_check.h>
'+' or '-'
Checks if a character is a sign symbol.
| c | Character to check. |
| int ft_isspace | ( | int | c | ) |
#include <include/ft_check.h>
Whitespace (space, tab, newline, etc.)
Checks if a character is a whitespace character.
Recognized: space, tab, newline, vertical tab, form feed, carriage return.
| c | Character to check. |
| bool ft_isstrpositive | ( | const char * | str | ) |
#include <include/ft_check.h>
Checks if string contains only digits and is > 0.
Checks if a string represents a positive number.
Returns 1 if the string exists, is non-empty, and does not start with '-'.
| str | Null-terminated string to check. |
| int ft_isupper | ( | int | c | ) |
#include <include/ft_check.h>
Uppercase letter.
Checks if a character is uppercase.
| c | Character to check. |
|
static |
#include <srcs/check/ft_is_valid_integer.c>
Checks if a numeric string fits within the long long range.
This helper function verifies whether the numeric value represented by the string (without sign prefix) is within the bounds of a signed long long, depending on whether it's negative.
Uses manual overflow detection logic to avoid undefined behavior.
| str | The numeric string to check (must not include the sign). |
| negative | Indicates if the original number was negative. |
long long, false otherwise.