Upload files to "src/string"

This commit is contained in:
2026-08-11 21:12:38 +00:00
parent 1984fb9269
commit d90f046561
2 changed files with 82 additions and 0 deletions
+66
View File
@@ -0,0 +1,66 @@
// this code is licenced under Wrathmark licence
// © 2026 wullie wulliestudio.com
// please see attached licence for full usage and rights
#include "LocalHeader.h"
#include "stdWullie/definitions/typeNull.h"
#include "stdWullie/String/colours.h"
#include "stdWullie/exit.h"
long unsigned lengthStr(char *string){
if(string == NULL){
safeError("a string was passed with a lenght of 0");
}
char *cursor = string;
while(*cursor){
cursor++;
}
long unsigned result = cursor - string;
return result;
}
// its print what did you expect? for it to read?
void printText(char *string){
syscall3(SYS_write, 1, (long)string, lengthStr(string));
}
void printReturn(char *string){
syscall3(SYS_write, 1, (long)string, lengthStr(string));
syscall3(SYS_write, 1, (long)"\n", 8);
}
// it can do everything that print can but better
void ColourPrint(char *string, char *colour){
syscall3(SYS_write, 1, (long)colour, lengthStr(colour));
syscall3(SYS_write, 1, (long)string, lengthStr(string));
syscall3(SYS_write, 1, (long)NORMAL, sizeof(NORMAL)-1);
}
// changes background instead of foreground
void BackgroundPrint(char *string, char *Bcolour){
syscall3(SYS_write, 1, (long)Bcolour, lengthStr(Bcolour));
syscall3(SYS_write, 1, (long)string, lengthStr(string));
syscall3(SYS_write, 1, (long)NORMAL, sizeof(NORMAL)-1);
}
// changes all letters to upper or lower depending on whats called
void upper(char string[]){
int i = 0;
while(string[i] != '\0'){
if(string[i] >= 'a' && string[i] <= 'z'){
string[i] = string[i] - 32;
}
i++;
}
}
void lower(char string[]){
int i = 0;
while(string[i] != '\0'){
if(string[i] >= 'A' && string[i] <= 'Z'){
string[i] = string[i] + 32;
}
i++;
}
}