示例#1
0
 /**
  * Format the postal code value into the following format : J4R 2L6.
  *
  * @param string $value The input string to format
  *
  * @return string The formatted value
  */
 public static function postalCode($value)
 {
     $new = '';
     if (strlen($value) > 0) {
         $new = str_replace(' ', '', $value);
         $new = substr($value, 0, 3);
         if (strlen($value) > 3) {
             $new .= ' ' . substr($value, 3, 3);
         }
         $new = Str::upper($new);
     }
     return $new;
 }
示例#2
0
 public function testUpper()
 {
     $this->assertEquals(Str::upper('foo'), 'FOO');
 }