fmt

package
v0.0.0-...-aea1278 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 28, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Example
exampleRun(`
	fmt := import("fmt")
	fmt.Print("print_")
	fmt.Println("line")
	fmt.Println("a", "b", 3)
	fmt.Printf("%v\n", [1, 2])
	fmt.Println(fmt.Sprint("x", "y", 4))

	a1 := fmt.ScanArg("str")
	a2 := fmt.ScanArg("int")
	r := fmt.Sscanf("abc 123", "%s%d", a1, a2)
	fmt.Println(r)
	fmt.Println(bool(a1), a1.Value)
	fmt.Println(bool(a2), a2.Value)
	`)
Output:

print_line
a b 3
[1, 2]
xy4
2
true abc
true 123

Index

Examples

Constants

This section is empty.

Variables

View Source
var Module = map[string]gad.Object{

	"Print": &gad.Function{
		Name:  "Print",
		Value: newPrint(fmt.Print),
	},

	"Printf": &gad.Function{
		Name:  "Printf",
		Value: newPrintf(fmt.Printf),
	},

	"Println": &gad.Function{
		Name:  "Println",
		Value: newPrint(fmt.Println),
	},

	"Sprint": &gad.Function{
		Name:  "Sprint",
		Value: newSprint(fmt.Sprint),
	},

	"Sprintf": &gad.Function{
		Name:  "Sprintf",
		Value: newSprintf(fmt.Sprintf),
	},

	"Sprintln": &gad.Function{
		Name:  "Sprintln",
		Value: newSprint(fmt.Sprintln),
	},

	"Sscan": &gad.Function{
		Name:  "Sscan",
		Value: newSscan(fmt.Sscan),
	},

	"Sscanf": &gad.Function{
		Name:  "Sscanf",
		Value: newSscanf(fmt.Sscanf),
	},

	"Sscanln": &gad.Function{
		Name:  "Sscanln",
		Value: newSscan(fmt.Sscanln),
	},

	"ScanArg": &gad.Function{
		Name:  "ScanArg",
		Value: newScanArgFunc,
	},
}

Module represents fmt module.

Functions

This section is empty.

Types

type ScanArg

type ScanArg interface {
	// Set sets status of scanning. It is set false before scanning and true
	// after scanning if argument is scanned.
	Set(bool)
	// Arg must return either a pointer to a basic ToInterface type or implementations of
	// fmt.Scanner interface.
	Arg() any
	// Value must return scanned, non-nil Gad Object.
	Value() gad.Object
}

ScanArg is an interface that wraps methods required to scan argument with scan functions.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL