Function overview
Prototype
MAC_Format_All (
text )
Parameters
text
Description
Tags:
NIC MAC Format
The MAC Address is the Ethernet hardware address of a NIC card or wireless card. This CF formats it into six octets separated by the designated separator (a colon).
For entries that are missing characters, the CF appends placeholders colored in red for easy recognition.
For entries that are too long, the extra characters are kept, but highlighted in red for easy recognition.
This version handles multiple MAC addresses separated by carriage returns.
Examples
Sample input
a1b1c1d1e
a2b2c2d2e2f2
a3b3c3d3e3f3g3h
Sample output
A1:B1:C1:D1:Ex:xx
A2:B2:C2:D2:E2:F2
A3:B3:C3:D3:E3:F3G3H
[The x placeholders and the extra characters, G3H in red.]
Function code
//MAC_Format_All(text)
//by Ender
/*
Formats a multi-line MAC address in the format:
AA:BB:CC:DD:EE:FF
AA:BB:CC:DD:EE:FF
Extra characters in each line and missing characters are formatted in red.
Recursive
Requires: MAC_Format_Single()
*/
Let(
c=ValueCount(text);
MAC_Format_Single(GetValue(text;1)) &
Case(c>1; ¶ & MAC_Format_All(RightValues ( text ; c-1 ))
)
)
// ===================================
/*
This function is published on FileMaker Custom Functions
to check for updates and provide feedback and bug reports
please visit http://www.fmfunctions.com/fid/225
Prototype: MAC_Format_All( text )
Function Author: Ender (http://www.fmfunctions.com/mid/39)
Last updated: 20 May 2009
Version: 1
*/
// ===================================
//MAC_Format_All(text)__LITBR__//by Ender__LITBR____LITBR__/*__LITBR__Formats a multi-line MAC address in the format: __LITBR__AA:BB:CC:DD:EE:FF__LITBR__AA:BB:CC:DD:EE:FF__LITBR____LITBR__Extra characters in each line and missing characters are formatted in red.__LITBR____LITBR__Recursive__LITBR__Requires: MAC_Format_Single()__LITBR____LITBR__*/__LITBR____LITBR__Let(__LITBR__c=ValueCount(text);__LITBR____LITBR__MAC_Format_Single(GetValue(text;1)) & __LITBR__Case(c>1; ¶ & MAC_Format_All(RightValues ( text ; c-1 ))__LITBR__)__LITBR__)__LITBR____LITBR__// ===================================__LITBR__/*__LITBR____LITBR__ This function is published on FileMaker Custom Functions__LITBR__ to check for updates and provide feedback and bug reports__LITBR__ please visit http://www.fmfunctions.com/fid/225__LITBR____LITBR__ Prototype: MAC_Format_All( text )__LITBR__ Function Author: Ender (http://www.fmfunctions.com/mid/39)__LITBR__ Last updated: 20 May 2009__LITBR__ Version: 1__LITBR____LITBR__*/__LITBR__// ===================================
Login or register to comment
Create a new account with fmcustomfunctions.com or login to post a comment.