Sha256: a399dde538a3442c36f28eda6f644918038868bc7c05b7389c04c9bec1186cf6

Contents?: true

Size: 866 Bytes

Versions: 4

Compression:

Stored size: 866 Bytes

Contents

// Gets substring from string
// -------------------------------------------------------------------------------
// @dependence `string-to-list()`
// -------------------------------------------------------------------------------
// @param $full-string [string] : string that contains substring
// @param $depth [number | string] : depth of substring
// -------------------------------------------------------------------------------
// @return [string]

@function get-substring($full-string, $depth) {
	@if is-string($full-string) {
		$get-substring: string-to-list($full-string);

		@if $depth == "last" {
			@return nth($get-substring, length($get-substring));
		} @else if $depth == "first" {
			@return nth($get-substring, 1);
		} @else {
			@return nth($get-substring, $depth);
		}
	} @else {
		@return "You did not input a valid string: #{$full-string}";
	}
}

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
flint-gs-1.6.2 stylesheets/flint/functions/lib/_get-substring.scss
flint-gs-1.6.0 stylesheets/flint/functions/lib/_get-substring.scss
flint-gs-1.5.0 stylesheets/flint/functions/lib/_get-substring.scss
flint-gs-1.4.0 stylesheets/flint/functions/lib/_get-substring.scss