Page 1 of 1

spacebug?

Posted: 16 Oct 2018, 01:38
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)

Re: spacebug?

Posted: 16 Oct 2018, 04:01
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.

Re: spacebug?

Posted: 31 Dec 2018, 01:26
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.

Re: spacebug?

Posted: 31 Dec 2018, 03:46
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.