|
Agents 1.5.0
Edge AI Agents SDK
|
Utility class providing static helper functions. More...
#include <utils.h>
Static Public Member Functions | |
| static void | changeKey (JsonObject &object, const std::string &old_key, const std::string &new_key) |
| Change a key in a JSON object. | |
| static std::string | toLower (const std::string &s) |
| Convert a string to lowercase. | |
| static std::string | toUpper (const std::string &s) |
| Convert a string to uppercase. | |
| static std::vector< std::string > | splitByNewline (const std::string &text) |
| Split a string by newlines. | |
| static void | trim (std::string &s) |
| String trim helper. | |
| static std::string | getBaseUrl (const std::string &url) |
| Extract the path (including leading '/') from a full URL. | |
| static std::string | getPathFromUrl (const std::string &url) |
| Extract the path (including leading '/') from a full URL. | |
| static std::string | getHostFromUrl (const std::string &url) |
| Get the hostname From Url object. | |
| static int | getPortFromUrl (const std::string &url) |
| Get the port from a URL string. | |
| static std::string | loadHtmlFile (const std::string &filename) |
| Load an HTML file from disk. | |
| static std::string | stripHtmlTags (const std::string &html, size_t max_length=0) |
| Strip HTML tags from a string, producing plain text. | |
| static std::string | extractHtmlTagContent (const std::string &html, const std::string &tag) |
| Extract the text content of the first occurrence of a given HTML tag. | |
Utility class providing static helper functions.
|
inlinestatic |
Change a key in a JSON object.
| object | The JSON object |
| old_key | The old key name |
| new_key | The new key name |
|
inlinestatic |
Extract the text content of the first occurrence of a given HTML tag.
| html | The HTML string to search |
| tag | The tag name to find (e.g., "title") |
|
inlinestatic |
Extract the path (including leading '/') from a full URL.
Example: https://example.com/api/search?q=x -> /api/search?q=x
| url | Full URL |
|
inlinestatic |
Get the hostname From Url object.
(e.g., "127.0.0.1") stripping "http://" and ":8080"
| url | The URL string |
|
inlinestatic |
Extract the path (including leading '/') from a full URL.
Example: https://example.com/api/search?q=x -> /api/search?q=x
| url | Full URL |
|
inlinestatic |
Get the port from a URL string.
Returns the port as an integer (defaulting to 80 or 443 if not found)
| url | The URL string |
|
inlinestatic |
Load an HTML file from disk.
| filename | The path to the HTML file |
|
inlinestatic |
Split a string by newlines.
| text | The text to split |
|
inlinestatic |
Strip HTML tags from a string, producing plain text.
Removes script/style/nav/header/footer/noscript blocks entirely, strips remaining tags, decodes common HTML entities, and collapses whitespace.
| html | The HTML string to strip |
| max_length | Maximum output length (0 = unlimited). Truncates at word boundary. |
|
inlinestatic |
Convert a string to lowercase.
| s | The input string |
|
inlinestatic |
Convert a string to uppercase.
| s | The input string |
|
inlinestatic |
String trim helper.
| s | the input string |