OpenBSD Handbook

Current snapshot · amd64 · Generated 2026-09-09

ruby40-scanf-1.0.0

implementation of the C function scanf

Back to search · Project homepage

Description

scanf is an implementation of the C function scanf(3), modified as necessary for Ruby compatibility. The methods provided are String#scanf, IO#scanf, and Kernel#scanf. Kernel#scanf is a wrapper around STDIN.scanf. IO#scanf can be used on any IO stream, including file handles and sockets. scanf can be called either with or without a block. Scanf scans an input string or stream according to a format, as described below in Conversions, and returns an array of matches between the format and the input. The format is defined in a string, and is similar (though not identical) to the formats used in Kernel#printf and Kernel#sprintf. The format may contain conversion specifiers, which tell scanf what form (type) each particular matched substring should be converted to (e.g., decimal integer, floating point number, literal string, etc.) The matches and conversions take place from left to right, and the conversions themselves are returned as an array. The format string may also contain characters other than those in the conversion specifiers. Whitespace (blanks, tabs, or newlines) in the format string matches any amount of whitespace, including none, in the input. Everything else matches only itself. Scanning stops, and scanf returns, when any input character fails to match the specifications in the format string, or when input is exhausted, or when everything in the format string has been matched. All matches found up to the stopping point are returned in the return array (or yielded to the block, if a block was given).

Package information

Ports path
devel/ruby-scanf
Package architecture
*
Maintainer
Sebastian Reitenbach <sebastia@openbsd.org>
Categories
devel, lang/ruby
Available flavors
ruby33, ruby34, ruby40

These are ports metadata. Binary availability depends on the release, architecture and mirror. Build and test dependencies are not an installation checklist.

Direct dependencies

Runtime

Build

Used by (2 dependency relationships)

Includes library, runtime, build and test relationships. Results load 100 at a time.

Installing and updating packages · Package details as JSON