Code - Custom Function
EncodeURL_CF ( textToCode )
BrianDunning.com, Brian Dunning http://www.briandunning.com/filemaker-custom-functions/list.php
Rate this function: Average rating: 5.0 (1 vote) Discuss this Custom FunctionPaul Spafford, Spafford Data Solutions
http://www.paulspafford.com
Encodes all urls enclosed in square brackets for html.
==================== SAMPLE INPUT AND OUTPUT ====================
INPUT
EncodeURL_CF ( TextField )
Where TextField contains the following:
FileMaker User and Developer Group of Eastern Ontario:
[http://www.fudgeo.com]
Spafford Data Solutions:
[http://www.paulspafford.com]
OUTPUT
FileMaker User and Developer Group of Eastern Ontario:
http://www.fudgeo.com
Spafford Data Solutions:
http://www.paulspafford.com
==================== DESCRIPTION ====================
When creating a multi-part email with an email plug-in, you need to encode any links as html, to make sure that more email applications will allow the links to be clickable.
When writing the text for the email, your users just need to enclose each url in square brackets.
==================== CUSTOM FUNCTION ====================
// CF name: EncodeURL_CF
// Parameters: textToCode
//
// Written by Paul Spafford
// Spafford Data Solutions
// www.paulspafford.com
//
// This function encodes all urls enclosed in square brackets for html.
Let ( [
@textToCode = textToCode
; @openSquarePos = Position ( @textToCode ; "[" ; 0 ; 1 )
; @closeSquarePos = Position ( @textToCode ; "]" ; 0 ; 1 )
; @afterOpenSquare = Right ( @textToCode ; Length ( @textToCode ) - @openSquarePos )
; @url = Left ( @afterOpenSquare ; @closeSquarePos - @openSquarePos - 1 )
; @encodedUrl = "" & @url & ""
; @subbed = Substitute ( @textToCode ; "[" & @url & "]" ; @encodedUrl )
];
Case (
PatternCount ( @subbed ; "[" ) = 0 or PatternCount ( @subbed ; "]" ) = 0
; @subbed
; EncodeURL_CF ( @subbed )
) // End Case
) // End Let
Referring URL: 'http://www.briandunning.com/cf/1119'
Keywords: ''
ClipManager:

