Skip to content

Commit

Permalink
- Adding count() function to Special Identifier action
Browse files Browse the repository at this point in the history
  • Loading branch information
SaviorXTanren committed Jan 26, 2024
1 parent 4b7912f commit 7119d28
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions MixItUp.Base/Model/Actions/SpecialIdentifierActionModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,15 @@ protected override async Task PerformInternal(CommandParametersModel parameters)
}
return Task.FromResult(text);
});
replacementText = await this.ProcessStringFunction(replacementText, "count", (text) =>
{
string[] splits = text.Split(new char[] { ',' });
if (splits != null && splits.Length == 2)
{
return Task.FromResult(Regex.Matches(splits[0], splits[1]).Count.ToString());
}
return Task.FromResult(text);
});
}

if (this.ShouldProcessMath)
Expand Down

0 comments on commit 7119d28

Please sign in to comment.