Get list of available words for given character

@param $char Needed character
@return array
163200
public static function listForCharacter($char)
    {
        $file = self::getDataFolder() . '/' . $char;
        $data = strtolower(file_get_contents($file));
        return explode("\n", $data);
    }
1139994
public function getCharacterResearchAgents(int $character_id): Collection
    {

        return CharacterAgentResearch::join(
            'invNames',
            'character_agent_researches.agent_id', '=',
            'invNames.itemID')
            ->join(
                'invTypes',
                'character_agent_researches.skill_type_id', '=',
                'invTypes.typeID')
            ->where('character_id', $character_id)
            ->get();
    }
69113
static function getWords($string, $lowercase = false) {

		$string = self::clean($string, ' ');

		// before an upper and a lower. FBar -> F Bar
		$string = preg_replace('/(.)([A-Z])([a-z])/', '$1 $2$3', $string);

		// between a lower and an upper. fooB -> foo B
		$string = preg_replace('/([a-z])([A-Z])/', '$1 $2', $string);

		// after any sequence of numbers.  45times -> 45 times
		$string = preg_replace('/([0-9])([^0-9])/', '$1 $2', $string);

		if ($lowercase) {
			$string = strtolower($string);
		}

		do {
			$string = str_replace('  ', ' ', $string, $count);
		} while ($count > 0);

		return explode(' ', $string);
	}
694993
protected function uniOrd($char)
    {
        $h = ord($char[0]);

        if ($h <= 0x7f) {
            return $h;
        } elseif ($h < 0xc2) {
            return null;
        } elseif ($h <= 0xdf) {
            return ($h & 0x1f) << 6 | (ord($char[1]) & 0x3f);
        } elseif ($h <= 0xef) {
            return ($h & 0x0f) << 12 | (ord($char[1]) & 0x3f) << 6
                                     | (ord($char[2]) & 0x3f);
        } elseif ($h <= 0xf4) {
            return ($h & 0x0f) << 18 | (ord($char[1]) & 0x3f) << 12
                                     | (ord($char[2]) & 0x3f) << 6
                                     | (ord($char[3]) & 0x3f);
        } else {
            return null;
        }
    }
170971
public static function get(string $str):array
    {
        $str = trim($str);
        $strArr = Str::toArray($str);
        $results = [];
        foreach ($strArr as $s) {
            $results[] = self::getSingle($s);
        }
        return $results;
    }
658000
protected function compileTargetCharacter($char)
    {
        switch (true) {
            case $char === 'remove':
                return function ($matches) {
                    return '';
                };

            case $char === 'keep':
                return function ($matches) {
                    return $matches[0];
                };

            case preg_match('("(?:[^\\\\"]+|\\\\\\\\|\\\\\'|\\\\")*?")', $char):
                $string = str_replace(
                    array('\\\\', '\\"', "\\'"),
                    array('\\', '"', "'"),
                    substr($char, 1, -1)
                );

                return function ($matches) use ($string) {
                    return $string;
                };

            default:
                $char = $this->compileCharacter($char);

                return function ($matches) use ($char) {
                    return $char;
                };
        }
    }
835631
public static Charset[] getAvailableCharsets() {
        Collection collection = Charset.availableCharsets().values();
        return (Charset[]) collection.toArray(EMPTY_CHARSET_ARRAY);
    }
273658
protected function convertHtmlToListOfWords($characterString)
    {
        $mode = 'character';
        $current_word = '';
        $words = array();
        $keepNewLines = $this->getConfig()->isKeepNewLines();
        foreach ($characterString as $i => $character) {
            switch ($mode) {
                case 'character':
                if ($this->isStartOfTag($character)) {
                    if ($current_word != '') {
                        $words[] = $current_word;
                    }

                    $current_word = '<';
                    $mode = 'tag';
                } elseif (preg_match("/\s/u", $character)) {
                    if ($current_word !== '') {
                        $words[] = $current_word;
                    }
                    $current_word = $keepNewLines ? $character : preg_replace('/\s+/Su', ' ', $character);
                    $mode = 'whitespace';
                } else {
                    if (
                        (($this->ctypeAlphanumUnicode($character) === true) && ($this->stringUtil->strlen($current_word) === 0 || $this->isPartOfWord($current_word))) ||
                        (in_array($character, $this->config->getSpecialCaseChars()) && isset($characterString[$i + 1]) && $this->isPartOfWord($characterString[$i + 1]))
                    ) {
                        $current_word .= $character;
                    } else {
                        $words[] = $current_word;
                        $current_word = $character;
                    }
                }
                break;
                case 'tag' :
                if ($this->isEndOfTag($character)) {
                    $current_word .= '>';
                    $words[] = $current_word;
                    $current_word = '';

                    if (!preg_match('[^\s]u', $character)) {
                        $mode = 'whitespace';
                    } else {
                        $mode = 'character';
                    }
                } else {
                    $current_word .= $character;
                }
                break;
                case 'whitespace':
                if ($this->isStartOfTag($character)) {
                    if ($current_word !== '') {
                        $words[] = $current_word;
                    }
                    $current_word = '<';
                    $mode = 'tag';
                } elseif (preg_match("/\s/u", $character)) {
                    $current_word .= $character;
                    if (!$keepNewLines) $current_word = preg_replace('/\s+/Su', ' ', $current_word);
                } else {
                    if ($current_word != '') {
                        $words[] = $current_word;
                    }
                    $current_word = $character;
                    $mode = 'character';
                }
                break;
                default:
                break;
            }
        }
        if ($current_word != '') {
            $words[] = $current_word;
        }

        return $words;
    }
1234284
function get_suggestions($word)
    {
        $matches = $word ? $this->check($word) : $this->matches;

        if ($matches[0][4]) {
            $suggestions = explode("\t", $matches[0][4]);
            if (count($suggestions) > self::MAX_SUGGESTIONS) {
                $suggestions = array_slice($suggestions, 0, self::MAX_SUGGESTIONS);
            }

            return $suggestions;
        }

        return array();
    }
574187
function get()
    {
        $result = array();

        foreach ((array)$this->matches as $item) {
            if ($this->engine == 'pspell') {
                $word = $item[0];
            }
            else {
                $word = mb_substr($this->content, $item[1], $item[2], RCUBE_CHARSET);
            }

            if (is_array($item[4])) {
                $suggestions = $item[4];
            }
            else if (empty($item[4])) {
                $suggestions = array();
            }
            else {
                $suggestions = explode("\t", $item[4]);
            }

            $result[$word] = $suggestions;
        }

        return $result;
    }
233165
function get_words($text = null)
    {
        $result = array();

        if ($text) {
            // init spellchecker
            $this->init();

            if (!$this->plink) {
                return array();
            }

            // With PSpell we don't need to get suggestions to return misspelled words
            $text = preg_split($this->separator, $text, NULL, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_OFFSET_CAPTURE);

            foreach ($text as $w) {
                $word = trim($w[0]);

                // skip exceptions
                if ($this->dictionary->is_exception($word)) {
                    continue;
                }

                if (!pspell_check($this->plink, $word)) {
                    $result[] = $word;
                }
            }

            return $result;
        }

        foreach ($this->matches as $m) {
            $result[] = $m[0];
        }

        return $result;
    }
379852
function _getWishIdsInEnteredMagicWords(word) {
  const startingCharWishesObj = _climbDownChain(
    _enteredMagicWords,
    word.split(''),
  )
  if (startingCharWishesObj) {
    return _getPropFromPosterity(startingCharWishesObj, 'wishes', true)
  } else {
    return []
  }
}
1249581
protected function handleCharacter($char)
    {
        # Ignore space, as we can't select multiple options
        if ($char === " ") {
            return false;
        }

        # Use enter to select the current option
        if ($char === "\n") {
            $this->checkboxes->toggleCurrent();
        }

        return parent::handleCharacter($char);
    }
584748
function _hangul_decompose($char)
    {
        $sindex = (int) $char - $this->_sbase;
        if ($sindex < 0 || $sindex >= $this->_scount) {
            return array($char);
        }
        $result = array();
        $result[] = (int) $this->_lbase + $sindex / $this->_ncount;
        $result[] = (int) $this->_vbase + ($sindex % $this->_ncount) / $this->_tcount;
        $T = intval($this->_tbase + $sindex % $this->_tcount);
        if ($T != $this->_tbase) $result[] = $T;
        return $result;
    }
721074
public function addSpecialCaseChar($char)
    {
        if (!in_array($char, $this->specialCaseChars)) {
            $this->specialCaseChars[] = $char;
        }

        return $this;
    }
325412
public static function char2Unicode($char)
    {
        switch (strlen($char)) {
            case 1 :
                return ord($char);
            case 2 :
                return (ord($char{1}) & 63) |
                    ((ord($char{0}) & 31) << 6);
            case 3 :
                return (ord($char{2}) & 63) |
                    ((ord($char{1}) & 63) << 6) |
                    ((ord($char{0}) & 15) << 12);
            case 4 :
                return (ord($char{3}) & 63) |
                    ((ord($char{2}) & 63) << 6) |
                    ((ord($char{1}) & 63) << 12) |
                    ((ord($char{0}) & 7) << 18);
            default :
                trigger_error('Character is not UTF-8!', E_USER_WARNING);
                return false;
        }
    }
506154
public function getAcceptableCharsets(?string $default = null): array
	{
		if(!isset($this->acceptableCharsets))
		{
			$this->acceptableCharsets = $this->parseAcceptHeader($this->get('accept-charset'));
		}

		return $this->acceptableCharsets ?: (array) $default;
	}