Changeset View
Changeset View
Standalone View
Standalone View
src/Strings/Multibyte/OmniString.php
Show First 20 Lines • Show All 57 Lines • ▼ Show 20 Lines | class OmniString { | ||||
public function endsWith (string $end) : bool { | public function endsWith (string $end) : bool { | ||||
return StringUtilities::endsWith($this->value, $end); | return StringUtilities::endsWith($this->value, $end); | ||||
} | } | ||||
public function len () : int { | public function len () : int { | ||||
return mb_strlen($this->value, $this->encoding); | return mb_strlen($this->value, $this->encoding); | ||||
} | } | ||||
public function getChars () : array { | |||||
$chars = []; | |||||
$len = $this->len(); | |||||
for ($i = 0 ; $i < $len ; $i++) { | |||||
$chars[] = mb_substr($this->value, $i, 1, $this->encoding); | |||||
} | |||||
return $chars; | |||||
} | |||||
public function getBigrams () { | |||||
$bigrams = []; | |||||
$len = $this->len(); | |||||
for ($i = 0 ; $i < $len - 1 ; $i++) { | |||||
$bigrams[] = mb_substr($this->value, $i, 2, $this->encoding); | |||||
} | |||||
return $bigrams; | |||||
} | |||||
/** | /** | ||||
* @return string | * @return string | ||||
*/ | */ | ||||
public function getValue () : string { | public function getValue () : string { | ||||
return $this->value; | return $this->value; | ||||
} | } | ||||
/** | /** | ||||
* @param string $value | * @param string $value | ||||
*/ | */ | ||||
public function setValue (string $value) { | public function setValue (string $value) { | ||||
$this->value = $value; | $this->value = $value; | ||||
} | } | ||||
dereckson: -\n | |||||
} | } |
Nasqueron DevCentral · If it had been much bigger the moon would have had a core of ice. · Powered by Phabricator
-\n