예제 #1
0
 public function testRegexResult1()
 {
     $this->assertEquals(Str::regexResult('/([\\w]+)/', 'foo bar', 0), ['foo', 'bar']);
 }
예제 #2
0
 /**
  * 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);
 }
예제 #3
0
 /**
  * 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;
 }