Skip to content

Commit 5830604

Browse files
committed
Add a new function to find the position of a substring in a string
1 parent 965c7cf commit 5830604

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ foo: '@=format("%s", "output")'
2424
* `fileName(string $string) : string` => Returns information about a file path
2525
* `dateTime(string $string) : string` => Returns new DateTimeImmutable object formatted according to the specified format
2626
* `formatDate(string $string) : string` => Returns date formatted according to given format
27+
* `position(string $haystack, string $needle, int $offset) : int|false` => Find the position of the first occurrence of a substring in a string

src/StringExpressionLanguageProvider.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ public function getFunctions(): array
1717
ExpressionFunction::fromPhp('substr', 'search'),
1818
ExpressionFunction::fromPhp('strtoupper', 'toUpperCase'),
1919
ExpressionFunction::fromPhp('number_format', 'formatNumber'),
20+
ExpressionFunction::fromPhp('strpos', 'position'),
2021
new FileName('fileName'),
2122
new DateTime('dateTime'),
2223
new FormatDate('formatDate'),

0 commit comments

Comments
 (0)