dictu-lang / Dictu

Dictu is a high-level dynamically typed, multi-paradigm, interpreted programming language.
https://dictu-lang.com
MIT License
267 stars 53 forks source link

Added IsLower and isUpper and wordCount string methods #724

Closed briandowns closed 10 months ago

briandowns commented 10 months ago

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:

#

Housekeeping:

#

Screenshots (If Applicable):

Jason2605 commented 10 months ago

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 commented 10 months ago

No rush. Thanks!

Jason2605 commented 10 months ago

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