str-extract-count-keyword()
카운트, 키워드 추출 유틸리티 함수
용도
사용법
@debug str-extract-count-keyword("main x3"); // (count: 3, keyword: 'main') 반환로직
@function str-extract-count-keyword($text: null) {
$index: str-index($text, 'x');
@if $index {
$keyword: str-replace(str-slice($text, 1, $index - 1), ' ');
$count: str-slice($text, $index + 1);
@return (count: str-to-num($count), keyword: $keyword);
} @else {
@return $text;
}
}참고
Last updated