CFLib.org – Common Function Library Project

Is7bit(text)

Last updated August 28, 2003

author

Vaughan Allan

Version: 1 | Requires: CF5 | Library: StrLib

Description:
Determines whether a string is 7bit. Useful for guessing if a string contains binary data (after reading a file using cffile for example).

Return Values:
Returns a boolean.

Example:

<CFSET str1 = "The mat sat on the cat.">
<CFSET str2 = "The mat sat on the c" & chr(225) & "t.">
<CFIF Is7bit(str1)>
	Str1 is 7 bit.<br>
</CFIF>
<CFIF Is7bit(str2)>
	Str2 is 7 bit.<br>
</CFIF>

Parameters:

Name Description Required
text String to check. Yes

Full UDF Source:

/**
 * Determines whether a string is 7bit
 * Rewritten by Ray Camden
 * 
 * @param text 	 String to check. (Required)
 * @return Returns a boolean. 
 * @author Vaughan Allan (vorn@__nospam__vorn.org) 
 * @version 1, August 28, 2003 
 */
function Is7bit(text) {
	if(REFind("[\x80-\xFF]",text)) return false;
	return true;	
}
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Kevin Cotton added
date2ExcelDate
May 5, 2016

Raymond Camden added
CapFirst
April 25, 2016

Chris Wigginton added
loremIpsum
January 18, 2016

Gary Stanton added
calculateArrival...
November 19, 2015

Sebastiaan Naafs - van Dijk added
getDaysInQuarter
November 13, 2015

Created by Raymond Camden / Design by Justin Johnson