Skip to content

Add substring method to string class#320

Merged
softmattertheory merged 1 commit into
Morpho-lang:devfrom
WoodchuckXL:substring
Jul 7, 2026
Merged

Add substring method to string class#320
softmattertheory merged 1 commit into
Morpho-lang:devfrom
WoodchuckXL:substring

Conversation

@WoodchuckXL

Copy link
Copy Markdown

Adds the String substring(int begin, int end) method to the string class.
Takes two integer arguments for the begin (inclusive) and end (exclusive) indices of the substring and returns a new substring of the original string between those indices. If the begin or end indices are outside of the bounds of the string, they will be clamped to beginning or end respectively. If the indices don't form a valid substring, substring returns an empty string.

@softmattertheory

Copy link
Copy Markdown
Contributor

This is a really useful contribution; thanks for including the test as well!

@softmattertheory softmattertheory merged commit 9341955 into Morpho-lang:dev Jul 7, 2026
6 checks passed
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