public function testRegexResult1() { $this->assertEquals(Str::regexResult('/([\\w]+)/', 'foo bar', 0), ['foo', 'bar']); }
/** * Get a slugized form of a string. * * @param string $value Value to obtain a slug from * * @return string slugized value */ function str_slug($value) { return \Anekdotes\Support\Str::slug($value); }
/** * Format the received value into a valid website. * * @param string $value The input string to format * * @return string The formatted value */ public static function website($value) { if (Str::startsWith($value, 'www')) { $value = 'http://' . $value; } elseif (Str::startsWith($value, '//')) { $value = 'http://' . substr($value, 2, strlen($value) - 2); } elseif (!Str::startsWith($value, 'http://')) { $value = 'http://' . $value; } return $value; }