StrStr() is Pos() or InStr() or StrPos() or StrLoc()

Just a public reminder to self that the function for locating (getting the position of) a substring within another string is named $StrStr(). Parameters, in order:

  1. String to search in / haystack. Commonly the name of a field, like %title%.
  2. Substring to search for / needle. Text is literal, not quote-enclosed.

When adjusting the position result to the right (add an integer) or left (subtract an integer), the expression should be enclosed in parens, like ($strstr(%title%, -)+2)

In this case, the hyphen was a separator between title and artist stored together in the %title% field. The action was supposed to copy to artist value from the %title% field to the %artist% field, by selecting the portion after the Space+Hyphen+Space. Didn't actually get it to work, so some of this post might be bogus.

Text can also be a variable.

If literal and contains a comma, it should be quote-enclosed.
The function then returns a number, not a string.

If you want to split a field, use an action of the type "Guess value"
Source: %title%
Target: %title% - %artist%

Also, I would like to point out that none of the following functions mentioned in the thread topic exist in MP3tag:
Neither Pos() nor InStr() nor StrPos() nor StrLoc()

No.
Scripting in Mp3tag is not a high level language, like VBScript.
Arithmetic operations do not use normal symbols: instead they are done by Arithmetic functions.
Like this:
$add($strstr(%title%, -),2) or $sub($strstr(%title%, -),2)

http://help.mp3tag.de/main_scripting.html#arithmetic

Thank you for the clarifications :slight_smile: I'm sure they will help others too. Especially "none of [those other] functions exist in MP3tag" Yes, that was my main reason for posting.

The salient point of "expression should be enclosed in parens" is that adjusting the result requires running another evaluation on it, which the arithmetic functions also do, just more naturally.

(Proper formatting unavailable because first time commenting from mobile.)

You can find a list of more string (and other) functions in the help:
http://help.mp3tag.de/main_scripting.html#string
and, if you need it, a list of Mp3tag internal variables:
http://help.mp3tag.de/options_export.html

Not also, but only. And parentheses are not necessarily required.
If %title% is The Beatles - Let It Be then
($strstr(%title%, -)+2) results in (12+2) which is a string and cannot be used arithmetically.
$add($strstr(%title%, -),2) gives 14, which is a number that can be used as an argument in another arithmetic function.