-
Notifications
You must be signed in to change notification settings - Fork 20
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
Enhanced String Length Handling #426
Enhanced String Length Handling #426
Conversation
Generally no concerns about adding such a functionality. However, this change breaks existing behavior. It would be fine to add it as a new function. |
Thanks for your quick reply! I totally see your point about not breaking current behavior. I just wanted to mention that the Java and Go CEL implementations handle string lengths differently, causing potential confusion. Happy to add this as a new function. Could you give me some pointers on that? |
So Go's string-length works differently? Interesting. Could you add some test-cases to validate the behavior? |
sure can, thanks for your thoughtful consideration. |
…ojis-as-single-characters
@Test | ||
void stringSizeEmoji() { | ||
assertThat(stringOf("").size()).isSameAs(IntZero); | ||
assertThat(stringOf("\uD83D\uDE05\uD83D\uDE04\uD83D\uDC7E").size()).isEqualTo(intOf(3)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is equal to "😅😄👾"
This PR introduces improvements to the way string length is handled. The existing
String.length()
method has limitations, and this proposal suggests alternative models for more accurate results. By considering Unicode codepoints and multilingual text, developers can achieve greater flexibility and precision.