Xteink-X4-crosspoint-reader/src/util/StringUtils.h
Arthur Tazhitdinov b1dcb7733b
fix: truncating chapter titles using UTF-8 safe function (#599)
## Summary

* Truncating chapter titles using utf8 safe functions (Cyrillic titles
were split mid codepoint)
* refactoring of lib/Utf8

---

### AI Usage

While CrossPoint doesn't have restrictions on AI tools in contributing,
please be transparent about their usage as it
helps set the right context for reviewers.

Did you use AI tools to help write this code? _**< PARTIALLY >**_
2026-02-01 22:23:48 +11:00

23 lines
597 B
C++

#pragma once
#include <WString.h>
#include <string>
namespace StringUtils {
/**
* Sanitize a string for use as a filename.
* Replaces invalid characters with underscores, trims spaces/dots,
* and limits length to maxLength characters.
*/
std::string sanitizeFilename(const std::string& name, size_t maxLength = 100);
/**
* Check if the given filename ends with the specified extension (case-insensitive).
*/
bool checkFileExtension(const std::string& fileName, const char* extension);
bool checkFileExtension(const String& fileName, const char* extension);
} // namespace StringUtils