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

Added IsLower and isUpper and wordCount string methods #724

Merged
merged 5 commits into from
Jan 12, 2024

Conversation

briandowns
Copy link
Contributor

@briandowns briandowns commented Jan 7, 2024

What's Changed:

Added IsLower and isUpper string methods. Since these methods are to be ran on single character strings, I returned false if the string length is more than 1 however I can see a case for returning or causing a runtime error. I'll defer to you (@Jason2605) for that final say. We can also create an optional "strings" module that contains extra utility functions and this could go in there.

Type of Change:

  • Bug fix
  • New feature
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Housekeeping:

  • Tests have been updated to reflect the changes done within this PR (if applicable).
  • Documentation has been updated to reflect the changes done within this PR (if applicable).

Screenshots (If Applicable):

Signed-off-by: Brian Downs <brian.downs@gmail.com>
Signed-off-by: Brian Downs <brian.downs@gmail.com>
Signed-off-by: Brian Downs <brian.downs@gmail.com>
@briandowns briandowns requested a review from Jason2605 January 7, 2024 20:00
@briandowns briandowns self-assigned this Jan 7, 2024
Signed-off-by: Brian Downs <brian.downs@gmail.com>
@briandowns briandowns changed the title Added IsLower and isUpper string methods Added IsLower and isUpper and wordCount string methods Jan 8, 2024
@Jason2605
Copy link
Member

I would have done it like you have now to be honest, methods on the string and always return a boolean value (regardless of string length!) I'll get round to reviewing them, sorry for being slow on this mate been a bit hectic in last few days

@briandowns
Copy link
Contributor Author

No rush. Thanks!

@Jason2605
Copy link
Member

Jason2605 commented Jan 9, 2024

Actually hold on I think I misunderstood your initial question. You're returning false if the string is greater than 1, not if it's 0. I would expect these methods to still return true if the string length is more than 1 but all characters are lower case, e.g "dictu".isLower() -> True (same with isUpper) thoughts?

Same way it works in Python for example: https://www.programiz.com/python-programming/methods/string/islower

Signed-off-by: Brian Downs <brian.downs@gmail.com>
Copy link
Member

@Jason2605 Jason2605 left a comment

Choose a reason for hiding this comment

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

Sorry for being slow on this, thank you for doing it!

@Jason2605 Jason2605 merged commit 89ced84 into dictu-lang:develop Jan 12, 2024
8 checks passed
@briandowns briandowns deleted the featuer/string_functions branch January 12, 2024 23:27
@Jason2605 Jason2605 mentioned this pull request Sep 12, 2024
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.

2 participants