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

Implements most _char procs and findlastextEx() #358

Closed
wants to merge 3 commits into from

Conversation

ike709
Copy link
Collaborator

@ike709 ike709 commented Aug 29, 2021

Closes #353
Closes #347
Closes #345
Closes #344
Closes #288
Closes #273
Closes #268

Adds _char() procs for every already-implemented text proc, and implements findlasttextEx()

The unimplemented text procs are splicetext(), spantext(), and nonspantext(). Issues exist for all 3.

@ike709
Copy link
Collaborator Author

ike709 commented Aug 29, 2021

When this PR is merged I'll update the Breaking Changes wiki page to point out that all procs work in chars instead of bytes.

@@ -333,7 +333,7 @@ public static DreamValue NativeProc_clamp(DreamObject instance, DreamObject usr,
end = text.Length + 1;
}

int needleIndex = text.IndexOf(needle, start - 1, end - start);
int needleIndex = text.IndexOf(needle, start - 1, end - start, StringComparison.OrdinalIgnoreCase);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm not sure if this is necessary but findtext() includes it so...

Copy link
Contributor

@PJB3005 PJB3005 left a comment

Choose a reason for hiding this comment

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

None of these _char implementations are correct. You should be returning code point positions (which BYOND erroneously refers to as "chars"), NOT .NET char indices (which are UTF-16 code units).

@ike709 ike709 marked this pull request as draft August 29, 2021 19:06
@ike709
Copy link
Collaborator Author

ike709 commented Aug 29, 2021

Turns out text encoding is a pain in the ass and this will need to be revisited.

@ike709 ike709 closed this Aug 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants