HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux ip-172-31-42-149 5.15.0-1084-aws #91~20.04.1-Ubuntu SMP Fri May 2 07:00:04 UTC 2025 aarch64
User: ubuntu (1000)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/vhost/disk-apps/pwa.sports-crowd.com/node_modules/@material/theme/_string-ext.scss
//
// Copyright 2021 Google LLC
// SPDX-License-Identifier: Apache-2.0
//

@use 'sass:string';

/// Checks if a string starts with a given prefix.
///
/// @example - scss
///   @debug has-prefix('var(--foo)', 'var('); // true
///
/// @param {String} $string - The string to test.
/// @param {String} $prefix - The prefix to check.
/// @return {Boolean} True if the string starts with the given prefix.
@function has-prefix($string, $prefix) {
  @return string.slice($string, 1, string.length($prefix)) == $prefix;
}

/// Checks if a string ends with a given suffix.
///
/// @example - scss
///   @debug has-suffix('var(--foo)', ')'); // true
///
/// @param {String} $string - The string to test.
/// @param {String} $suffix - The suffix to check.
/// @return {Boolean} True if the string ends with the given suffix.
@function has-suffix($string, $suffix) {
  @return string.slice($string, -1 * string.length($suffix)) == $suffix;
}

/// Trims a repeating prefix from the start of a string.
///
/// @example - scss
///   @debug trim-repeating-prefix('  foo bar  ', ' '); // "foo bar  "
///
/// @param {String} $string - The string to trim.
/// @param {String} $prefix - The repeating prefix string to trim.
/// @return {String} The string with the prefix trimmed from the start.
@function trim-repeating-prefix($string, $prefix) {
  @while has-prefix($string, $prefix) {
    $string: trim-prefix($string, $prefix);
  }

  @return $string;
}

/// Trims a prefix from the start of a string.
///
/// @example - scss
///   @debug trim-prefix('var(--foo)', 'var('); // "--foo)"
///
/// @param {String} $string - The string to trim.
/// @param {String} $prefix - The prefix string to trim.
/// @return {String} The string with the prefix trimmed from the start.
@function trim-prefix($string, $prefix) {
  @if has-prefix($string, $prefix) {
    $string: string.slice($string, string.length($prefix) + 1);
  }

  @return $string;
}

/// Trims a repeating suffix from the end of a string.
///
/// @example - scss
///   @debug trim-repeating-suffix('  foo bar  ', ' '); // "  foo bar"
///   @debug trim-repeating-suffix('var(--foo)', ')'); // "var(--foo"
///
/// @param {String} $string - The string to trim.
/// @param {String} $suffix - The repeating suffix string to trim.
/// @return {String} The string with the suffix trimmed from the end.
@function trim-repeating-suffix($string, $suffix) {
  @while has-suffix($string, $suffix) {
    $string: trim-suffix($string, $suffix);
  }

  @return $string;
}

/// Trims a suffix from the end of a string.
///
/// @example - scss
///   @debug trim-suffix('var(--foo)', ')'); // "var(--foo"
///
/// @param {String} $string - The string to trim.
/// @param {String} $suffix - The suffix string to trim.
/// @return {String} The string with the suffix trimmed from the end.
@function trim-suffix($string, $suffix) {
  @if has-suffix($string, $suffix) {
    $string: string.slice($string, 1, -1 * string.length($suffix) - 1);
  }

  @return $string;
}

/// Trims a repeating prefix and suffix from the start and end of a string.
///
/// If a suffix is not provided, the prefix is used as the suffix to trim.
///
/// @example - scss
///   @debug trim-repeating('  foo bar  ', ' '); // "foo bar"
///
/// @param {String} $string - The string to trim.
/// @param {String} $prefix - The repeating prefix string to trim.
/// @param {String} $suffix [$prefix] - The repeating suffix string to trim.
/// @return {String} The string with the prefix and suffix trimmed.
@function trim-repeating($string, $prefix, $suffix: $prefix) {
  @return trim-repeating-prefix(
    trim-repeating-suffix($string, $suffix),
    $prefix
  );
}

/// Trims a prefix and suffix from the start and end of a string.
///
/// If a suffix is not provided, the prefix is used as the suffix to trim.
///
/// @example - scss
///   @debug trim('var(--foo)', 'var(', ')'); // "--foo"
///
/// @param {String} $string - The string to trim.
/// @param {String} $prefix - The prefix string to trim.
/// @param {String} $suffix [$prefix] - The suffix string to trim.
/// @return {String} The string with the prefix and suffix trimmed.
@function trim($string, $prefix, $suffix: $prefix) {
  @return trim-prefix(trim-suffix($string, $suffix), $prefix);
}