Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add STRSLICE(str, start, end) function with zero-based and indexing #1625

Open
Rangi42 opened this issue Jan 25, 2025 · 1 comment
Open

Add STRSLICE(str, start, end) function with zero-based and indexing #1625

Rangi42 opened this issue Jan 25, 2025 · 1 comment
Labels
enhancement Typically new features; lesser priority than bugs rgbasm This affects RGBASM
Milestone

Comments

@Rangi42
Copy link
Contributor

Rangi42 commented Jan 25, 2025

Based on ISSOtm/rsgbds#9

This would be an alternative to STRSUB without the 1-based indexing issue and with a negative end index possibility.

This would let you do STRSLICE("string", start, end) instead of the more verbose STRSUB("string", start, STRLEN("string") - end - start). (And when you want a fixed length, STRSLICE("string", start, start + length) is not much more verbose than STRSUB("string", start, length), though either would still be an option.)

@Rangi42 Rangi42 added enhancement Typically new features; lesser priority than bugs rgbasm This affects RGBASM labels Jan 25, 2025
@Rangi42 Rangi42 added this to the 0.9.1 milestone Jan 25, 2025
@Rangi42 Rangi42 self-assigned this Jan 25, 2025
@Rangi42 Rangi42 modified the milestones: 0.9.1, 0.9.2 Jan 26, 2025
@Rangi42 Rangi42 removed their assignment Jan 26, 2025
@Rangi42
Copy link
Contributor Author

Rangi42 commented Jan 28, 2025

The other function that currently has 1-based indexing is CHARSUB. We could add a CHARAT function with 0-based indexing, in the hopes that STRSUB and CHARSUB will one day be deprecated or changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Typically new features; lesser priority than bugs rgbasm This affects RGBASM
Projects
None yet
Development

No branches or pull requests

1 participant