Conversation
Enhanced the `substring` function: - Added two overloads: with and without length parameter. - Improved handling of edge cases: - 1-based to 0-based index conversion. - Clamping of negative indices and lengths. - Handling of out-of-bounds indices and lengths. Updated `README.md` to document the `substring` function.
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds a new substring function to the Simpra expression language with two overloads (with and without length parameter) and comprehensive edge case handling including 1-based to 0-based index conversion, negative value clamping, and bounds checking.
Key changes:
- Added substring function with two overloads supporting 1-based indexing
- Implemented robust edge case handling for negative indices, out-of-bounds access, and length clamping
- Added comprehensive test coverage for various scenarios including Unicode strings and boundary conditions
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/AltaSoft.Simpra/Types/SimpraString.cs |
Enhanced substring implementation with improved edge case handling and 1-based indexing |
src/AltaSoft.Simpra/InternalLanguageFunctions.cs |
Added substring function overloads to internal language functions |
tests/AltaSoft.Simpra.tests/SimpraExpressionTests.cs |
Added comprehensive test coverage for substring function edge cases |
README.md |
Added documentation for the new substring function |
Directory.Build.props |
Version bump from 1.0.15 to 1.0.16 |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Enhanced the
substringfunction:Updated
README.mdto document thesubstringfunction.