Strstr broken? result is always 0

I tried to use $strstr inside a format value action. It did not work in every combination i tried. I ended up with something like

Format Value
Field: Title
Format String: $strstr(%_filename%, "e")

The filename of course contained the character 'e'. The result was, as in my previous tests, 0. Is this the expected result?

Try it using the correct syntax:


Result: 15
Filename: Albinoni-Trumpet Concerto

This works too when searching only for one character:


Result: 15
Filename: Albinoni-Trumpet Concerto

But what should bring this expression in an action 'Format Value' on the tag-field TITLE?


My example was part of a larger expression. I tried to use the strstr part basically to determine if a filename contains a given string.

Thanks for hinting to the difference between '0' and "0". Was i supposed to know that? The documentation usually uses double quotes for strings.

Guess thats my fault. I mixed up websources and actions.


Never mind, Mp3tag's several scripting languages and their loose syntax are good for more than one recurring confusion.


The difference is the space between the parameters:

-u302320: $strstr(%_filename%, "e")
DetlevD: $strstr(%_filename%,'e')

The second of these works, the first doesn't. Either kind of quote mark is fine

As a programmer I wasn't expecting this and it took me hours to figure it out!

No, double quotes are treated as literals.

$strstr(%_filename%,e) is another possibility.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.