Skip to content

Add substring method to string class#320

Open
WoodchuckXL wants to merge 1 commit into
Morpho-lang:devfrom
WoodchuckXL:substring
Open

Add substring method to string class#320
WoodchuckXL wants to merge 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.

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.

1 participant