FrostWing
A lightweight raw-control operating system.
Loading...
Searching...
No Matches
strings.h
Go to the documentation of this file.
1
11#include <stdint.h>
12#include <stddef.h>
13#include <stdbool.h>
14#include <basics.h>
15
16#define MAX_WORDS 30
17#define MAX_WORD_LEN 40
18
19#define CONCAT(...) \
20 str_concat_impl(sizeof((const char*[]){__VA_ARGS__}) / sizeof(const char*), __VA_ARGS__)
21
22// typedef char symbol[];
23
33int strlen(char s[]);
34
42string strcpy(string dest, cstring src);
43
52string strncpy(string dest, cstring src, size_t n);
53
66int strcmp(cstring s1, cstring s2);
67
81int strncmp(cstring s1, cstring s2, size_t n);
82
92bool contains(cstring str, cstring substr);
93
106void string_transport_front(char *str, int x);
107
118string trim(cstring str);
119
131string strcat(string dest, cstring src);
132
138void remove_last_char(string str);
139
149long strtol(const char *str, char **endptr, int base);
150
157char* uint_to_string(unsigned int num);
158
164char* hex_to_string(signed int num, bool caps);
165
172char* leading_trailing_trim(const char *str);
173
182char** splitf(const char* str, char delim, int* num_tokens);
183
190int isspace(char c);
191
192char* trim_inplace(char* s);
193
194char* strrchr(const char* s, int c);
This is a basic header files with FrostWing specific short forms and basically a good for life header...
char * leading_trailing_trim(const char *str)
Removes the leading and trailing spaces.
string strcpy(string dest, cstring src)
Copies a string from src to dest.
char ** splitf(const char *str, char delim, int *num_tokens)
Splits a string into tokens based on a delimiter.
int strcmp(cstring s1, cstring s2)
Compares two strings lexicographically.
int strncmp(cstring s1, cstring s2, size_t n)
Compares two strings, up to a specified number of characters.
string trim(cstring str)
Creates a new string without spaces from a C-style string.
string strncpy(string dest, cstring src, size_t n)
Copies n characters from src to dest.
char * uint_to_string(unsigned int num)
Converts an uint to string.
int isspace(char c)
Implemented for sh.c.
char * hex_to_string(signed int num, bool caps)
Prints Hexadecimal number.
void remove_last_char(string str)
Removes the last char.
int strlen(char s[])
Calculate the length of a null-terminated string.
bool contains(cstring str, cstring substr)
Check if a substring is found within a string.
string strcat(string dest, cstring src)
Concatenate two strings.
long strtol(const char *str, char **endptr, int base)
Converts a string to a long integer.
void string_transport_front(char *str, int x)
Move the last x characters of a string to the front and delete the rest.