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

Wrong report in Jaseci Builtin str actions #949

Closed
TharukaCkasthuri opened this issue Feb 20, 2023 · 1 comment
Closed

Wrong report in Jaseci Builtin str actions #949

TharukaCkasthuri opened this issue Feb 20, 2023 · 1 comment
Labels
bug Something isn't working as expected. consumer depending A consumer of Jaseci is depending on this issue.

Comments

@TharukaCkasthuri
Copy link
Collaborator

.str::is_alnum is to Return true if the string is alpha numerical. but this action returns true only if the string only contains numerical values.

Ex:

walker init{
    _string = "123 Hello World";
    report _string.str::is_alnum;
}

This reports false.

But

walker init{
    _string = "123";
    report _string.str::is_alnum;
}

this reports true.

@TharukaCkasthuri TharukaCkasthuri changed the title Wrong report in Jaseci Builtin actions Wrong report in Jaseci Builtin str actions Feb 20, 2023
@TharukaCkasthuri TharukaCkasthuri added bug Something isn't working as expected. consumer depending A consumer of Jaseci is depending on this issue. labels Feb 20, 2023
@twschutz
Copy link
Contributor

I believe that this is the correct behavior for .str::is_alnum.

In your first example:

walker init{
    _string = "123 Hello World";
    report _string.str::is_alnum;
}

This reports False because the string "123 Hello World" is not alphanumeric as it has space characters " " that are not numerals or letters.

If you were to replace the whitespace from the string first:

walker init{
    _string = "123 Hello World";
    _string = _string.str::replace(" ", "");
   report _string;
   report _string.is_alnum;
}

This reports "123HelloWorld", True

@ypkang ypkang closed this as completed Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working as expected. consumer depending A consumer of Jaseci is depending on this issue.
Projects
None yet
Development

No branches or pull requests

3 participants