protected function SearchApiPorter2::charAt in Search API 7
Retrieves the character at the given position.
Parameters
int $position: The 0-based index of the character. If a negative number is given, the position is counted from the end of the string.
string|null $word: (optional) The word from which to retrieve the character. Defaults to $this->word.
Return value
string The character at the given position, or an empty string if the given position was illegal.
4 calls to SearchApiPorter2::charAt()
- SearchApiPorter2::isVowel in includes/
processor_stemmer.inc - Checks whether a character is a vowel.
- SearchApiPorter2::step2 in includes/
processor_stemmer.inc - Implements step 2 of the Porter2 algorithm.
- SearchApiPorter2::step4 in includes/
processor_stemmer.inc - Implements step 4 of the Porter2 algorithm.
- SearchApiPorter2::step5 in includes/
processor_stemmer.inc - Implements step 5 of the Porter2 algorithm.
File
- includes/
processor_stemmer.inc, line 512 - Contains SearchApiPorterStemmer and SearchApiPorter2.
Class
- SearchApiPorter2
- Implements the Porter2 stemming algorithm.
Code
protected function charAt($position, $word = NULL) {
if ($word === NULL) {
$word = $this->word;
}
$length = strlen($word);
if (abs($position) >= $length) {
return '';
}
if ($position < 0) {
$position += $length;
}
return $word[$position];
}