.
This commit is contained in:
parent
95d74c2ef4
commit
a66e58193f
25 changed files with 2600 additions and 93 deletions
12
str.c
12
str.c
|
|
@ -1,5 +1,7 @@
|
|||
#include "str.h"
|
||||
|
||||
#include "os.h"
|
||||
|
||||
#include <limits.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
|
|
@ -396,7 +398,11 @@ bool char_is_num(char c) {
|
|||
}
|
||||
|
||||
char char_lower(char c) {
|
||||
return c >= 'A' && c <= 'Z' ? c - 32 : c;
|
||||
return c >= 'A' && c <= 'Z' ? c + 32 : c;
|
||||
}
|
||||
|
||||
char char_upper(char c) {
|
||||
return c <= 'a' && c >= 'z' ? c - 32 : c;
|
||||
}
|
||||
|
||||
// == INPUT STREAM =================================================
|
||||
|
|
@ -657,9 +663,11 @@ char ostr_back(outstream_t *ctx) {
|
|||
str_t ostr_to_str(outstream_t *ctx) {
|
||||
ostr_putc(ctx, '\0');
|
||||
|
||||
usize len = ostr_tell(ctx);
|
||||
|
||||
str_t out = {
|
||||
.buf = ctx->beg,
|
||||
.len = ostr_tell(ctx) - 1,
|
||||
.len = len ? len - 1 : 0,
|
||||
};
|
||||
|
||||
memset(ctx, 0, sizeof(outstream_t));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue