monster.util.formatMacAddress()

Syntax

monster.util.formatMacAddress(macAddress);

Parameters

KeyDescriptionTypeDefaultRequired
macAddressString to format as MAC address.Stringtrue

Return value

A String representation of a MAC address or an empty String if macAddress could not be formatted.

Errors

  • "macAddress" is not a string

Description

The monster.util.formatMacAddress() method is used to format strings into lowercased string representations of MAC addresses with colons as separators.

Examples

monster.util.formatMacAddress('');
// => ''

monster.util.formatMacAddress('28E0ss974M13');
// => ''

monster.util.formatMacAddress('2');
// => ''

monster.util.formatMacAddress('28E0ff974F1');
// => ''

monster.util.formatMacAddress('28E0ff974F13');
// => '28:e0:ff:97:4f:13'

monster.util.formatMacAddress('  28E0ff974F13  ');
// => '28:e0:ff:97:4f:13'

monster.util.formatMacAddress('$28 E0+ff:97-4F_13}');
// => '28:e0:ff:97:4f:13'