Skip to contents

Converts MAC addresses written in any supported notation to a common upper-case format.

Usage

normalize_MAC(mac, sep = ":")

Arguments

mac

A character vector of MAC addresses.

sep

Separator to use in the output. Use "" for plain hexadecimal.

Value

A character vector. Invalid addresses become NA.

Examples

normalize_MAC(c("1c-4c-7e-30-d8-13", "1c4c.7e30.d813", "not a MAC"))
#> [1] "1C:4C:7E:30:D8:13" "1C:4C:7E:30:D8:13" NA                 
normalize_MAC("1C:4C:7E:30:D8:13", sep = "-")
#> [1] "1C-4C-7E-30-D8-13"