spanIncluding

Description

Gets characters from a string, from the beginning and stops when it encounters any character that is not in a specified set of characters. The search is case sensitive.

Categories

Related

Syntax

SpanIncluding(string, set)

Attributes

AttributeDescriptionRequiredDefault
setA string or a variable that contains a set of characters. Must contain one or more characters.
stringA string or a variable that contains the search string.

Returns

A string; characters from string, from the beginning to a character that is not in set.

Example

<h3>SpanIncluding Example</h3> 
<cfif IsDefined("FORM.myString")> 
Your string was <cfoutput>#FORM.myString#</cfoutput> 
Your set of characters was <cfoutput>#FORM.mySet#</cfoutput> 
Your string, until the characters in the set have been found, is: 
<cfoutput>#SpanIncluding(FORM.myString, FORM.mySet)#</cfoutput> 
</cfif> 
 
Returns characters of a string, from beginning to a character  
    that is not in set. The search is case-sensitive. 
 
<form action = "spanincluding.cfm" method="post"> 
Enter a string: 
<br><input type = "Text" name = "myString" value = "Hey, you!"> 
And a set of characters: 
<br><input type = "Text" name = "mySet" value = "ey,H"> 
<br><input type = "Submit" name = ""> 
</form>