src/Mbcraft/Piol/StringBuffer.php
function scanf($format)
    {
        $spec_pattern = "/%[+-]?('.)?[-]?(\d)*(\..\d)?[%bcdeEfFgGosuxX]/";

        $source = substr($this->data,$this->pos);

        $result = sscanf($source,$format);

        if ($result==-1) return;
        else {
            $l = 0;
            foreach ($result as $v) {
                $l += strlen("".$v);
            }
        }

        $no_patterns_format = preg_replace($spec_pattern,"",$format);
        //echo "No patterns format : [".$no_patterns_format."] LEN=".strlen($no_patterns_format);
        $l+=strlen($no_patterns_format);

        $this->pos+=$l;

        return $result;
    }
function scanf($format)
    {
        $spec_pattern = "/%[+-]?('.)?[-]?(\d)*(\..\d)?[%bcdeEfFgGosuxX]/";

        $source = substr($this->data,$this->pos);

        $result = sscanf($source,$format);

        if ($result==-1) return;
        else {
            $l = 0;
            foreach ($result as $v) {
                $l += strlen("".$v);
            }
        }

        $no_patterns_format = preg_replace($spec_pattern,"",$format);
        //echo "No patterns format : [".$no_patterns_format."] LEN=".strlen($no_patterns_format);
        $l+=strlen($no_patterns_format);

        $this->pos+=$l;

        return $result;
    }
Reads data from this reader following the 'scanf' parameter convention.

@param string $format The format string of the data to read
@return array An array of ordered values readed following the format provided.

@api