kgoba-ft8_lib/libs/libft8/include/ft8_text.h

38 wiersze
991 B
C
Czysty Zwykły widok Historia

2021-08-05 10:56:35 +00:00
#ifndef _INCLUDE_TEXT_H_
#define _INCLUDE_TEXT_H_
2018-10-24 07:35:06 +00:00
2021-08-05 10:56:35 +00:00
#include <stdbool.h>
#include <stdint.h>
2021-08-05 10:56:35 +00:00
// Utility functions for characters and strings
2018-10-24 07:35:06 +00:00
2021-08-05 10:56:35 +00:00
const char *trim_front(const char *str);
void trim_back(char *str);
char *trim(char *str);
2021-08-05 10:56:35 +00:00
char to_upper(char c);
bool is_digit(char c);
bool is_letter(char c);
bool is_space(char c);
bool in_range(char c, char min, char max);
bool starts_with(const char *string, const char *prefix);
bool equals(const char *string1, const char *string2);
2018-10-28 08:39:39 +00:00
2021-08-05 10:56:35 +00:00
int char_index(const char *string, char c);
2018-10-28 08:39:39 +00:00
2021-08-05 10:56:35 +00:00
// Text message formatting:
// - replaces lowercase letters with uppercase
// - merges consecutive spaces into single space
void fmtmsg(char *msg_out, const char *msg_in);
2021-08-05 10:56:35 +00:00
// Parse a 2 digit integer from string
int dd_to_int(const char *str, int length);
2021-08-05 10:56:35 +00:00
// Convert a 2 digit integer to string
2021-08-05 11:07:31 +00:00
void int_to_dd(char *str, int value, int width, bool full_sign);
2021-08-05 10:56:35 +00:00
char charn(int c, int table_idx);
int nchar(char c, int table_idx);
#endif // _INCLUDE_TEXT_H_