Module: Toybox::Lang

Overview

The Lang module contains Monkey C language basic types, and provides a method for formatting Strings.

Since:

  • 1.0.0

Defined Under Namespace

Classes: Array, Boolean, ByteArray, Char, Dictionary, Double, Exception, Float, InvalidOptionsException, InvalidValueException, Long, Method, Number, Object, SerializationException, StorageFullException, String, Symbol, SymbolNotAllowedException, UnexpectedTypeException, ValueOutOfBoundsException, WeakReference

Instance Method Summary collapse

Instance Method Details

format(format, parameters) ⇒ Toybox::Lang::String

Create a formatted String by substituting the given parameters into the given format at the corresponding locations.

Examples:

// Set the 'myString' variable to "Your next meeting is at 2:30 on Sep 4 in room 6820."
using Toybox.Lang
var myFormat = "Your next meeting is at $1$:$2$ on $3$ $4$ in room $5$.";
var myParams = [2, 30, "Sep", 4, "6820"];
var myString = Lang.format(myFormat, myParams);

Parameters:

Returns:

Since:

  • 1.0.0


5843
5844
# File 'Monkeybrains.rb', line 5843

def format(format, parameters)
end