spacebug?

All your suggestions, requests and ideas for future development
Post Reply
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

spacebug?

Post by kim »

Is this a bug or a misleading function ?

Code: Select all

{def title = 'S.W.A.T. (2017)'; title }
Correct way:
S.W.A.T. (2017)

Code: Select all

{def title = 'S.W.A.T. (2017)'; title.space(' - ') }
output:
S - W - A - T - (2017)
like with

Code: Select all

{n} - {s00e00} - {t}

Code: Select all

{def title = 'S.W.A.T. (2017)'; title.space('') }
output:
SWAT(2017)
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: spacebug?

Post by rednoah »

[._ ]+ is all considered space. If you want to support special patterns like S.W.A.T. then you'd have to write your own pattern that somehow takes care of that.
:idea: Please read the FAQ and How to Request Help.
devster
Posts: 417
Joined: 06 Jun 2017, 22:56

Re: spacebug?

Post by devster »

Why are points and underscores considered space?
I can see how it would be useful while cleaning the file name for release search but not when the title has already been matched.
I only work in black and sometimes very, very dark grey. (Batman)
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: spacebug?

Post by rednoah »

That's just what String.space() does, and it's been around for a long time, so depending on your use case, it may or may not do exactly what you want. Besides, if String.space() was just replacing space with space, then there wouldn't be much of a point to it. :lol:

Indeed, you wouldn't typically use String.space() on bindings such as n or t because the data is gonna be clean and won't require further clean up.
:idea: Please read the FAQ and How to Request Help.
Post Reply