Skip to content

Commit 6ddef3e

Browse files
committed
feat(@clayui/css): Global Functions adds starts-with($str1, $str2). A function that determines whether the string $str1 begins with the characters of the specified string $str2.
1 parent 2697c1e commit 6ddef3e

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

packages/clay-css/src/scss/functions/_global-functions.scss

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,20 @@
634634
@return max($val1, $val2);
635635
}
636636

637+
/// A function that determines whether the string `$str1` begins with the characters of the specified string `$str2`. This returns `true` if `$str1` begins with `$str2`.
638+
/// @param {String} $str1 - The string to search.
639+
/// @param {String} $str2 - The search parameter.
640+
641+
@function starts-with($str1, $str2) {
642+
$returnVal: false;
643+
644+
@if (str-index($str1, $str2) == 1) {
645+
$returnVal: true;
646+
}
647+
648+
@return $returnVal;
649+
}
650+
637651
// * REUSE-Snippet-Begin
638652
// * SPDX-License-Identifier: MIT
639653
// * SPDX-FileCopyrightText: © 2016 Hugo Giraudel <https://hugogiraudel.com/>

0 commit comments

Comments
 (0)