alcamo/input-stream
最新稳定版本:0.4.7
Composer 安装命令:
composer require alcamo/input-stream
包简介
Input stream vaguely inspired by C++ istream
README 文档
README
<?php
use alcamo\input_stream\StringInputStream;
include $_composer_autoload_path ?? __DIR__ . '/../vendor/autoload.php';
$text = <<<EOT
foo=bar ; example assignment
EOT;
$stream = new StringInputStream($text);
echo "Left: " . $stream->extractUntil('=') . PHP_EOL;
echo "Equal sign: " . $stream->extract() . PHP_EOL;
echo "Right: " . $stream->extractRegexp('/[a-z]+/') . PHP_EOL;
echo "Comment: " . $stream->extractWsAndComments() . PHP_EOL;
This example is contained in this package as a file in the bin
directory. It will output
Left: foo
Equal sign: =
Right: bar
Comment: ; example assignment
Overview
This package provides input streams vaguely inspired by C++
istream. In addition to C++-like methods such as extract(),
isGood(), peek(), putback(), they provide convenenience methods
such as extractUntil() or extractRegexp().
The class StringInputStream is for strings where one byte
corresponds to one character, auch as ASCII or ISO-8859, while
MbStringInputStream supports multibyte character sets such as
UTF-8. The former should be preferred if applicable because it is
faster.
See the doxygen documentation for details.
统计信息
- 总下载量: 51
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2021-06-30