INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: How to find newlines in descriptions and suppress them?  (Read 2664 times)

8139david

  • Galactic Citizen
  • ****
  • Posts: 345
How to find newlines in descriptions and suppress them?
« on: June 04, 2016, 06:21:16 am »

I'd like to automatically find newlines in descriptions and suppress them.

Eg replace
"svsvs vvsdsv
aze okpkp

"

by
"svsvs vvsdsv aze okpkp"

How can I do that?
Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: How to find newlines in descriptions and suppress them?
« Reply #1 on: June 04, 2016, 07:28:22 am »

This expression should do it:

Code: [Select]
=replace([Description],/#
#/,/ )

Note that I've typed a literal return character in between the /# and #/ sequences.  I've replaced it with a single space after the / character.  You could put something else there to replace it with like 2 spaces, or a special sequence like <n> or whatever you want.

Brian.
Logged

8139david

  • Galactic Citizen
  • ****
  • Posts: 345
Re: How to find newlines in descriptions and suppress them?
« Reply #2 on: June 04, 2016, 07:43:06 am »

Thanks, this seems to work.

However, it doesn't always show correctly in Tooltips. In the attached pic, you can see that 2 lines are added after the description (here Description3 calculated from Description using your expression), while only one should be according to my definition of tooltip:

If(IsEqual([Media Sub Type],Movie,1), <font size="140">>[Name]<//b> • [Year]<//font>
If(!IsEmpty([Comment]),[Comment], If(IsEqual([File Type],iso,1),[File Type],TVInfo(SizeDisplay)If(!IsEmpty([Compression]),/ •/ [Compression],/ •/ [File Type])))

,)If(!IsEmpty([Genre]),Genre:<//b> [Genre]
,)If(!IsEmpty([Description3]),Description3:<//b> [Description3]

,)If(!IsEmpty([Director]),Director:<//b> [Director]
,)If(!IsEmpty([Country]),Country:<//b> [Country]
,)If(!IsEmpty([Actors]),Actors:<//b> [Actors]
,)
Logged

8139david

  • Galactic Citizen
  • ****
  • Posts: 345
Re: How to find newlines in descriptions and suppress them?
« Reply #3 on: June 04, 2016, 08:31:15 am »

I have an apparently good result with this expression:

=removecharacters([Description],/#
#/,2)
Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: How to find newlines in descriptions and suppress them?
« Reply #4 on: June 04, 2016, 08:50:48 am »

I'm having trouble figuring out why the first one doesn't work correctly, but it looks like you've solved it to your satisfaction, so that's great.  :)

Brian.
Logged
Pages: [1]   Go Up