💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
# Abstract class Phalcon\\Text # Abstract class **Phalcon\\Text** Provides utilities to work with texts ### Constants *integer***RANDOM\_ALNUM** *integer***RANDOM\_ALPHA** *integer***RANDOM\_HEXDEC** *integer***RANDOM\_NUMERIC** *integer***RANDOM\_NOZERO** ### Methods public static **camelize** (*unknown* $str) Converts strings to camelize style ``` <pre class="calibre14">``` <?php echo Phalcon\Text::camelize('coco_bongo'); //CocoBongo ``` ``` public static **uncamelize** (*unknown* $str) Uncamelize strings which are camelized ``` <pre class="calibre14">``` <?php echo Phalcon\Text::uncamelize('CocoBongo'); //coco_bongo ``` ``` public static **increment** (*unknown* $str, \[*unknown* $separator\]) Adds a number to a string or increment that number if it already is defined ``` <pre class="calibre14">``` <?php echo Phalcon\Text::increment("a"); // "a_1" echo Phalcon\Text::increment("a_1"); // "a_2" ``` ``` public static **random** (\[*unknown* $type\], \[*unknown* $length\]) Generates a random string based on the given type. Type is one of the RANDOM\_\* constants ``` <pre class="calibre14">``` <?php echo Phalcon\Text::random(Phalcon\Text::RANDOM_ALNUM); //"aloiwkqz" ``` ``` public static **startsWith** (*unknown* $str, *unknown* $start, \[*unknown* $ignoreCase\]) Check if a string starts with a given string ``` <pre class="calibre14">``` <?php echo Phalcon\Text::startsWith("Hello", "He"); // true echo Phalcon\Text::startsWith("Hello", "he", false); // false echo Phalcon\Text::startsWith("Hello", "he"); // true ``` ``` public static **endsWith** (*unknown* $str, *unknown* $end, \[*unknown* $ignoreCase\]) Check if a string ends with a given string ``` <pre class="calibre14">``` <?php echo Phalcon\Text::endsWith("Hello", "llo"); // true echo Phalcon\Text::endsWith("Hello", "LLO", false); // false echo Phalcon\Text::endsWith("Hello", "LLO"); // true ``` ``` public static **lower** (*unknown* $str, \[*unknown* $encoding\]) Lowercases a string, this function makes use of the mbstring extension if available ``` <pre class="calibre14">``` <?php echo Phalcon\Text::lower("HELLO"); // hello ``` ``` public static **upper** (*unknown* $str, \[*unknown* $encoding\]) Uppercases a string, this function makes use of the mbstring extension if available ``` <pre class="calibre14">``` <?php echo Phalcon\Text::upper("hello"); // HELLO ``` ``` public static **reduceSlashes** (*unknown* $str) Reduces multiple slashes in a string to single slashes ``` <pre class="calibre14">``` <?php echo Phalcon\Text::reduceSlashes("foo//bar/baz"); // foo/bar/baz echo Phalcon\Text::reduceSlashes("http://foo.bar///baz/buz"); // http://foo.bar/baz/buz ``` ``` public static **concat** () Concatenates strings using the separator only once without duplication in places concatenation ``` <pre class="calibre14">``` <?php $str = Phalcon\Text::concat("/", "/tmp/", "/folder_1/", "/folder_2", "folder_3/"); echo $str; // /tmp/folder_1/folder_2/folder_3/ ``` ``` public static **dynamic** (*unknown* $text, \[*unknown* $leftDelimiter\], \[*unknown* $rightDelimiter\], \[*unknown* $separator\]) Generates random text in accordance with the template ``` <pre class="calibre14">``` <?php echo Phalcon\Text::dynamic("{Hi|Hello}, my name is a {Bob|Mark|Jon}!"); // Hi my name is a Bob echo Phalcon\Text::dynamic("{Hi|Hello}, my name is a {Bob|Mark|Jon}!"); // Hi my name is a Jon echo Phalcon\Text::dynamic("{Hi|Hello}, my name is a {Bob|Mark|Jon}!"); // Hello my name is a Bob ``` ``` | - [索引](# "总目录") - [下一页](# "Abstract class Phalcon\Translate") | - [上一页](# "Abstract class Phalcon\Tag\Select") | - [API Indice](#) »