Skip to content

Commit 49e089c

Browse files
Update cstring.h
1 parent 6d03637 commit 49e089c

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

code/logic/fossil/io/cstring.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,29 @@ void fossil_io_cstring_free(cstring str);
5757
*/
5858
cstring fossil_io_cstring_copy(ccstring str);
5959

60+
/**
61+
* @brief Converts an English number string into an integer.
62+
*
63+
* Example: "twenty-three" -> 23
64+
*
65+
* @param str Input string containing the number in English.
66+
* @param out Pointer to integer where the parsed number will be stored.
67+
* @return 0 on success, non-zero on error (invalid input).
68+
*/
69+
int fossil_io_cstring_number_from_words(const char *str, int *out);
70+
71+
/**
72+
* @brief Converts an integer number into its English representation.
73+
*
74+
* Example: 23 -> "twenty-three"
75+
*
76+
* @param num The integer to convert.
77+
* @param buffer The output buffer to store the English string.
78+
* @param size The size of the output buffer.
79+
* @return 0 on success, non-zero if the buffer is too small.
80+
*/
81+
int fossil_io_cstring_number_to_words(int num, char *buffer, size_t size);
82+
6083
/**
6184
* @brief Duplicates the given cstring.
6285
*

0 commit comments

Comments
 (0)