Recase() function

Things you’d like to miss in the future...
Forum rules
:warnred20: :warnred20: :warnred20: :warnred20: :warnred20: READ THIS AND DO IT!!! :warnred20: :warnred20: :warnred20: :warnred20: :warnred20:

:info: Please include the following information:
1) Your XYplorer Version (e.g., v28.00.0801)
2) Your Windows Version (e.g., Win 11)
3) Your Screen Scaling Percentage (e.g., 125%).

:info: We strongly recommend adding your Windows Version and Screen Scaling Percentage to the Location field in your Profile or to your Signature. That way, you only have to type them once, and we won't have to search for that vital information.

:info: When attaching an Image, please use the Attachment tab at the bottom of your post and click "Add files".

:warnred20: :warnred20: :warnred20: :warnred20: :warnred20: READ THIS AND DO IT!!! :warnred20: :warnred20: :warnred20: :warnred20: :warnred20:
Post Reply
JohnM
Posts: 289
Joined: 08 Jun 2006 11:59
Location: Windows 11 Pro @100%

Recase() function

Post by JohnM »

Hi All,

I apologise if this has been asked elsewhere.

The recase() function doesn't work the way I expect when doing title case.

In the below example I expected the result to be: "Bbc The Making Of King Arthur" which would fall in line with the help. See attachment.

Am I misinterpreting what recase() should do or is there a setting I need to change?

Cheers
John
To see the attached files, you need to log into the forum.
Windows 11 Pro x64
XYplorer 28.30.0000 x64

highend
Posts: 14992
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Recase() function

Post by highend »

One of my scripts helped you out? Please donate via Paypal

JohnM
Posts: 289
Joined: 08 Jun 2006 11:59
Location: Windows 11 Pro @100%

Re: Recase() function

Post by JohnM »

Ah ok. Thanks Highend!
Windows 11 Pro x64
XYplorer 28.30.0000 x64

admin
Site Admin
Posts: 66619
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Recase() function

Post by admin »

JohnM wrote: 06 Jul 2021 23:30 Ah ok. Thanks Highend!
Are you unhappy with the changes? I might extend SC recase() to give you more control.

highend
Posts: 14992
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Recase() function

Post by highend »

Another flag to disregard the entries of the tweak would be nice...
One of my scripts helped you out? Please donate via Paypal

admin
Site Admin
Posts: 66619
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Recase() function

Post by admin »

Went this way:

Code: Select all

    + SC recase enhanced: Added parameter "title_case_exceptions".
      Syntax: recase(string, [mode], [flags], [title_case_exceptions])
        title_case_exceptions:
          missing: Use the global defaults (as stored at key RenameTitleCaseExceptions)
          empty: Do not use any exceptions
          else: Use this ";"-separated list of exceptions, e.g. "a;an;the"
      Examples for Title Case:
        text recase("the caMel BITES the horse.", "t");                 //The Camel Bites the Horse. (factory default exceptions)
        text recase("the caMel BITES the horse.", "t", , "");           //The Camel Bites The Horse. (no exceptions)
        text recase("the caMel BITES the horse.", "t", , "the;bites");  //The Camel bites the Horse. (custom exceptions)
      Examples for Camel Case:
        text recase("the caMel BITES the horse.", "c");                 //The CaMel BITES the Horse. (factory default exceptions)
        text recase("the caMel BITES the horse.", "c", , "");           //The CaMel BITES The Horse. (no exceptions)
        text recase("the caMel BITES the horse.", "c", , "the;bites");  //The CaMel bITES the Horse. (custom exceptions)

JohnM
Posts: 289
Joined: 08 Jun 2006 11:59
Location: Windows 11 Pro @100%

Re: Recase() function

Post by JohnM »

Hi Don,

I think the change is a good one, but extending the function is a great idea. Thanks 8)
Windows 11 Pro x64
XYplorer 28.30.0000 x64

jupe
Posts: 3462
Joined: 20 Oct 2017 21:14
Location: Win10 22H2 120dpi

Re: Recase() function

Post by jupe »

Don, I have a query on the new behavior of recase, when it is used with a string that has a period in it, the function seems to always make the last word lowercase (maybe assumes its an extension?), should that happen even when the flag is not set? eg:

Code: Select all

 text recase("word.word.word.word", "t");	// EXPECT ALL TO BE TITLE CASE
 text recase("word.word.word.word", "t", 1);	// EXPECT ALL EXCEPT LAST WORD TITLE CASE

admin
Site Admin
Posts: 66619
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Recase() function

Post by admin »

Yep, that's a bug. Fix comes. :tup: :cup:

Post Reply