Commit Graph
7 Commits
Author SHA1 Message Date
Walter Schell 2049f1bfb1 feat: add String.fromByte primitive with validation and unit tests
Implement a new String.fromByte(_) static method that creates a single-byte string from an integer 0-255. Includes runtime validation for non-integer, non-numeric, negative, and out-of-range values. Adds the underlying wrenStringFromByte helper in wren_value.c and exposes it via a new DEF_PRIMITIVE in wren_core.c. Documents the method in the core string markdown and provides six test cases covering happy path and all error conditions.
2019-02-27 13:05:07 +00:00
Bob Nystrom ffc9ec950c feat: add trim, trimEnd, trimStart methods with optional chars argument to String class
Implement six new trimming methods on String: trim(), trim(chars), trimEnd(), trimEnd(chars), trimStart(), trimStart(chars). The core logic uses a private trim_ helper that accepts a chars string, converts it to code points, and iterates from the start and/or end of the string to remove matching characters. Default whitespace set is tab, carriage return, newline, and space. Includes comprehensive test coverage for default and custom character trimming, edge cases (empty strings, all-trimmed strings, 8-bit clean data), and runtime error when chars argument is not a string.
2018-07-15 17:48:56 +00:00
Bob Nystrom 996ba2b2cd fix: correct typo "seperator" to "separator" in string.markdown docs
Fix three occurrences of the misspelled word "seperator" in the string module
documentation, updating both the function signature header and the descriptive
text in the split() method section.
2017-03-15 14:06:07 +00:00
Andew Jones 6fa769beeb feat: add split and replace methods to String class with tests and docs 2017-03-08 02:12:03 +00:00
Bob Nystrom 59a6fc1bcc feat: add negative start support and validate index in String.indexOf(_,_)
Simplify arithmetic in wrenStringFind by removing startIndex offset from loop range and using start directly as the initial index. Rename internal primitives to string_indexOf1 and string_indexOf2 for clarity. Add validateIndex helper to clamp negative start values and reject out-of-bounds indices. Update documentation to describe the new start parameter behavior. Add comprehensive test suite for indexOf with start, including negative offsets, edge cases, and error conditions.
2016-08-04 05:19:34 +00:00
Sven Bergström 995fc241e6 docs: fix iterator protocol link to use relative path from core/ module docs 2016-05-21 02:51:47 +00:00
Bob Nystrom 909c242a03 chore: reorganize doc site structure by moving core docs under modules/ and removing category metadata
Restructure the documentation hierarchy to prepare for documenting additional built-in modules. Move all core library documentation from `doc/site/core/` to `doc/site/modules/core/`, rename `modules.markdown` to `modularity.markdown`, remove `^category` metadata lines from all affected pages, update cross-reference links to use relative paths under the new structure, and add a TODO placeholder to the Class class page.
2015-11-08 21:31:22 +00:00