Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x

StringHelper.php

Namespace

SlevomatCodingStandard\Helpers

File

vendor/slevomat/coding-standard/SlevomatCodingStandard/Helpers/StringHelper.php

View source
<?php

declare (strict_types=1);
namespace SlevomatCodingStandard\Helpers;

use function strlen;
use function strpos;
use function substr;

/**
 * @internal
 */
class StringHelper {
    public static function startsWith(string $haystack, string $needle) : bool {
        return $needle === '' || strpos($haystack, $needle) === 0;
    }
    public static function endsWith(string $haystack, string $needle) : bool {
        return $needle === '' || substr($haystack, -strlen($needle)) === $needle;
    }

}

Classes

Title Deprecated Summary
StringHelper @internal

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal