MAC_Format_All ( )

Function stats

Average user rating
39
225
9999
Support
FileMaker 8.0 +
Date posted
20 May 2009
Version
1
Recursive function
Yes

Author Info
 Ender

4 functions

Average Rating None

author_avatar



 

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

*/
// ===================================