carlos-montiers / enhancedbatch

Enhances your windows command prompt https://www.enhancedbatch.com
Other
5 stars 1 forks source link

New Filters #27

Open carlos-montiers opened 4 years ago

carlos-montiers commented 4 years ago

I want propose this next related to the filters:

rename CAPITAL to TITLE with the same behavior: each first letter of each word is uppercased. add SENTENCE which behavior is like TITLE, but only is uppercased the first letter of the first word.

add TRIMPREFIX where it remove the prefix string as text, not as a cutset add TRIMSUFFIX where it remove the suffix string as text, not as a cutset.

What about add alias TRIMLEFT and TRIMRIGHT for LTRIM and RTRIM respectively?

adoxa commented 4 years ago

TITLE I'm okay with, SENTENCE not so much - it implies knowing what a sentence is and I really don't want to get into that. An option/alternative to TITLE would be better, I think.

How about an S (for string) suffix to LTRIM/RTRIM? ltrim[xy] - remove all leading x and y characters; ltrims[xy] - remove leading string xy; or even take Dave's approach: ltrim'xy'. Does it remove the first, or all? (I guess just the first, since repeating strings are unlikely.) Hm, maybe replace them all and just use regex substitution: s/[xy]*(.*)/\1/ or s/(?:xy)?(.*)/\1/ or s/(?:xy)*(.*)/\1/. Maybe not, a bit verbose for a relatively common operation. Plus I don't know when I'll get around to regex...

carlos-montiers commented 4 years ago

What about: CAPITAL -> CAPALL and add CAPFIRST that is like the previous but only for the first word ?

And for the trim: TRIM, LTRIM, RTRIM works using cutset. PTRIM, STRIM works using strings, the first removes prefix and the latter suffix.

adoxa commented 4 years ago

I think TITLE for all and TITLEFIRST for the first. ... No, it still doesn't feel right. Maybe TITLEBEG(IN)?

Not sure I like that. Maybe replace TRIM instead - LDEL/RDEL to delete a string from the left/right. If we force the use of quotes it could be generalised to remove a number of characters, too: ldel[5] - remove the first five characters; rdel['xyz'] - remove string xyz from the end.

carlos-montiers commented 4 years ago

I love that syntax. I agree on all of it