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

**URL:** <https://community.mp3tag.de/t/strstr-is-pos-or-instr-or-strpos-or-strloc/47624>\
**Category:** Support\
**Created:** [January 23, 2020, 11:12pm UTC](https://community.mp3tag.de/t/strstr-is-pos-or-instr-or-strpos-or-strloc/47624 "2020-01-23T23:12:09Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bilbo47](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/b/35a633/32.png) [@Bilbo47](https://community.mp3tag.de/u/Bilbo47)\
**Post date:** [January 23, 2020, 11:12pm UTC](https://community.mp3tag.de/t/strstr-is-pos-or-instr-or-strpos-or-strloc/47624/1 "2020-01-23T23:12:09Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)\
**Post date:** [January 24, 2020, 5:45am UTC](https://community.mp3tag.de/t/strstr-is-pos-or-instr-or-strpos-or-strloc/47624/2 "2020-01-24T05:45:31Z")

</div>

> [@Bilbo47](#):
>
> Text is literal

Text can also be a variable.

> [@Bilbo47](#):
>
> not quote-enclosed.

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

> [@Bilbo47](#):
>
> 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.

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()

---

<div class="post-metadata">

**Author:** ![ryerman](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ryerman/32/5285_2.png) [@ryerman](https://community.mp3tag.de/u/ryerman)\
**Post date:** [January 24, 2020, 7:29am UTC](https://community.mp3tag.de/t/strstr-is-pos-or-instr-or-strpos-or-strloc/47624/3 "2020-01-24T07:29:52Z")

</div>

> [@Bilbo47](#):
>
> 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)

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)`

> **[Scripting Functions – Mp3tag Documentation](https://docs.mp3tag.de/scripting/#arithmetic-functions)**
>
> Documentation on Mp3tag's scripting functions. Mp3tag is the universal Tag Editor.

---

<div class="post-metadata">

**Author:** ![Bilbo47](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/b/35a633/32.png) [@Bilbo47](https://community.mp3tag.de/u/Bilbo47)\
**Post date:** [January 25, 2020, 5:49am UTC](https://community.mp3tag.de/t/strstr-is-pos-or-instr-or-strpos-or-strloc/47624/4 "2020-01-25T05:49:16Z")

</div>

Thank you for the clarifications 🙂 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.)

---

<div class="post-metadata">

**Author:** ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)\
**Post date:** [January 25, 2020, 8:52am UTC](https://community.mp3tag.de/t/strstr-is-pos-or-instr-or-strpos-or-strloc/47624/5 "2020-01-25T08:52:31Z")

</div>

You can find a list of more string (and other) functions in the help:

> **[Scripting Functions – Mp3tag Documentation](https://docs.mp3tag.de/scripting/#string-functions)**
>
> Documentation on Mp3tag's scripting functions. Mp3tag is the universal Tag Editor.

and, if you need it, a list of Mp3tag internal variables:  
[https://docs.mp3tag.de/export](https://docs.mp3tag.de/export)

---

<div class="post-metadata">

**Author:** ![ryerman](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ryerman/32/5285_2.png) [@ryerman](https://community.mp3tag.de/u/ryerman)\
**Post date:** [January 25, 2020, 8:10pm UTC](https://community.mp3tag.de/t/strstr-is-pos-or-instr-or-strpos-or-strloc/47624/6 "2020-01-25T20:10:43Z")

</div>

> [@Bilbo47](#):
>
> 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

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**.

---

<div class="post-metadata">

**Author:** ![system](https://community.mp3tag.de/uploads/default/original/2X/c/ce7035d426cb755a7916793326d23b465222a407.png) [@system](https://community.mp3tag.de/u/system)\
**Post date:** [February 9, 2026, 12:28pm UTC](https://community.mp3tag.de/t/strstr-is-pos-or-instr-or-strpos-or-strloc/47624/7 "2026-02-09T12:28:25Z")

</div>


