2021-10-19 09:37:49 +02:00
|
|
|
#ifndef __STRING__
|
|
|
|
#define __STRING__
|
2021-10-07 14:51:19 +02:00
|
|
|
|
2023-08-10 11:13:06 +02:00
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#define ALPHABET_LENGTH 26
|
2021-10-07 14:51:19 +02:00
|
|
|
#define ALPHABET "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
|
|
|
|
2023-08-10 11:13:06 +02:00
|
|
|
/**
|
|
|
|
* @brief Return the length of a string (excluding '\0').
|
|
|
|
*
|
|
|
|
* @param string
|
|
|
|
*/
|
|
|
|
size_t string_get_length(const char* string);
|
|
|
|
|
2021-10-07 14:51:19 +02:00
|
|
|
/**
|
|
|
|
* @brief Shift the alphabet by a given amount.
|
|
|
|
*
|
|
|
|
* @param shift
|
|
|
|
* @return char*
|
|
|
|
*/
|
|
|
|
char* string_shift_alphabet(int shift);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Encrypts a string using the Caesar cipher.
|
|
|
|
*
|
|
|
|
* @param string
|
|
|
|
* @param shift
|
|
|
|
* @return char*
|
|
|
|
*/
|
|
|
|
char* string_caesar_cipher(char* string, int shift);
|
|
|
|
|
|
|
|
#endif
|