View Issue Details

IDProjectCategoryView StatusLast Update
0019347MMW 5Tagging / organizing (properties / auto-tools)public2022-11-02 18:24
Reporterpeke Assigned To 
PriorityhighSeverityfeatureReproducibilityN/A
Status closedResolutionreopened 
Target Version5.0.4Fixed in Version5.0.4 
Summary0019347: Masks: Add ability to get the POS and LAST position of String within String
DescriptionIn masks there should be a way to Add ability to get the POS of String within String eg.

$pos(string,what) = $pos(<Album>, :) -> Album: "Original Motion Picture Soundtrack: Footloose" = 35

$last(string,what) = $pos(<Album>,oo) -> Album: "Original Motion Picture Soundtrack: Footloose" = 42

It will be very useful along with $len(string)
Additional Informationhttps://www.mediamonkey.com/forum/viewtopic.php?t=102546
TagsNo tags attached.
Fixed in build2675

Relationships

related to 0019346 closedLudek Masks: Add ability that n param can be string and not just numeric 
related to 0017355 closedjiri Closing Parenthesis breaks Auto-Organize (Files) 

Activities

Ludek

2022-09-05 11:58

developer   ~0069167

Last edited: 2022-09-05 12:12

From what I see here: https://www.mediamonkey.com/forum/viewtopic.php?t=102546
user is rather asking for something like
$CutBefore(string,what)

i.e. tracked in 0019346:0069166

Ludek

2022-09-05 14:39

developer   ~0069170

Last edited: 2022-09-05 14:41

Assigned back to me as the $POS will be needed to find whether a character/substring is part of the string at all.

e.g.
$if( $pos(:,<album>) > 0, $Trim($RightFrom(<album>, :)), <album>)

Ludek

2022-09-05 19:37

developer   ~0069171

Fixed in 5.0.4.2662

lowlander

2022-09-09 16:52

developer   ~0069196

Not sure what exactly has been implemented here but $pos() always returns 0.

Used $pos(<Album>,:) on an Album with :

Ludek

2022-09-12 10:20

developer   ~0069210

Last edited: 2022-09-12 10:20

As per my example above it is $pos(what, string) -- > not $pos(string, what)
i.e. use $pos(:,<album>) instead

peke

2022-09-21 21:37

developer   ~0069453

Verified 2663

lowlander

2022-10-20 16:06

developer   ~0069888

Why is it $pos(what, string) not $pos(string, what), it seems that goes counter to all other methods available.

Ludek

2022-10-20 17:41

developer   ~0069893

Last edited: 2022-10-20 17:41

OK, it was because e.g. in Delphi/Pascal the pos is defined as Pos(const SubStr, Str)

But you are right that for consistency with mask functions in MM it's better to exchange the params,
so exchanged to $pos(string, what) in build 2674

lowlander

2022-10-20 21:01

developer   ~0069898

On 2764:
1 $pos(<album>, :) gives length of Album + 1 instead of expected : position (space is allowed in other masks)
2 $pos(<album> , :) gives length of Album + 2 instead, but $pos(<album> ,:) works

Ludek

2022-10-21 10:41

developer   ~0069917

Last edited: 2022-10-21 10:41

Good catch.
=> Fixed in 2675

lowlander

2022-10-21 17:06

developer   ~0069932

Confirmed on 2675.