INTERACT FORUM

Please login or register.

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

Author Topic: String Manipulation Function  (Read 463 times)

SonicYouth

  • Recent member
  • *
  • Posts: 10
String Manipulation Function
« on: May 05, 2020, 02:50:10 am »

Hi everyone, this question is not related to MC26, but I don't know where to ask it. Sorry for this.

How can characters left or right from a specific character be deleted?

Example:

[Artist]="The Drifters / Money Honey"
[Name]="The Drifters / Money Honey"

If I want

[Artist]="The Drifter"
[Name]="Money Honey"

it should be possible to delete everything right or left from "/"? Can anyone tell me the expression?  ::) Thank you.  :D

Logged

lepa

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2033
Re: String Manipulation Function
« Reply #1 on: May 05, 2020, 03:43:16 am »

Create a list and use " / " as a delimiter. 0 index is first part and 1 index is the second part
ListItem(your field to be separated,0,/ /// )

Examples:
ListItem(Drifters // Money Honey,0,/ /// ) ==> Drifters
ListItem(Drifters // Money Honey,1,/ /// ) ==> Money Honey
Blue part can be any text or field like [Name]
ref: https://wiki.jriver.com/index.php/List_Manipulation_Functions#ListItem
Logged

SonicYouth

  • Recent member
  • *
  • Posts: 10
Re: String Manipulation Function
« Reply #2 on: May 05, 2020, 04:11:48 am »

Thank you so much lepa. Extremely helpful.  ;D
Logged

dtc

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 3119
Re: String Manipulation Function
« Reply #3 on: May 05, 2020, 07:54:56 am »

Version 26.0.37 added the Find function. It finds a string (or character)  (in this case /) in a string and returns a number corresponding to where the string is found. You can then use the Right and Left functions to extract the beginning and end of the string. Or you can use RemoveLeft and RemoveRight to remove characters from the string. Length returns the total length of the string.  These are old fashion functions, but often easier to use than regex or the List functions.  See Expression Language in the Wiki for everything other than Find.
Logged
Pages: [1]   Go Up