Skip to content

Add substring function#16

Merged
temonk merged 1 commit intomainfrom
bugfix/simpraStringsubstring
Sep 23, 2025
Merged

Add substring function#16
temonk merged 1 commit intomainfrom
bugfix/simpraStringsubstring

Conversation

@temonk
Copy link
Copy Markdown
Contributor

@temonk temonk commented Sep 23, 2025

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.

@temonk temonk requested a review from Copilot September 23, 2025 09:20
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.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@altasoft altasoft deleted a comment from Copilot AI Sep 23, 2025
@temonk temonk merged commit 420c4ad into main Sep 23, 2025
1 check passed
@temonk temonk deleted the bugfix/simpraStringsubstring branch September 23, 2025 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants