[FEATURE] Add String Case Methods in Expressions
Description of the requested feature
Add the following string case related functions to the expression language:
lower(string) -> stringupper(string) -> stringI don't other conversions (uppercase first letter, snake case, camel case, etc) are that common and can be done with regex. Potentially also useful:strip(string) -> string- (remove whitespace from either side of a string) maybe the default string widget andlabelshould automatically strip their text?
Proposed configuration syntax
I'm assigning css classes based on the battery status from EWW_BATTERY.BAT0.status, which returns the status as a string starting with a capital letter, which isn't the convention for css classes. It would look like this:
(defwidget battery []
(box :class "battery ${lower(EWW_BATTERY.BAT0.status)}"
...)
)
Additional context
All these operations are already possible with regex, but I feel like they're common enough to warrant dedicated methods.
hi dear Sounds good, i coded it but i had no time to test it can you please test it if it works i can open a pull request to the main String Methods
hi dear Sounds good, i coded it but i had no time to test it can you please test it if it works i can open a pull request to the main String Methods
I tested it and it works great, I think trim is actually a better name than strip (I was looking at the python string methods names when thinking about the names)
Okay, thanks i will rename it and open a pull request to the master later on today