Whatever message this page gives is out now! Go check it out!

SpanIncluding

Last update:
May 18, 2026

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. For example, SpanIncluding("mystring", "mystery") returns "mystr". Because, in the string "mystring", after "mystr", the character 'i' (which is not present in the second string "mystery") is encountered.

Returns

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

Category

Function syntax

SpanIncluding(string, set)

See also

GetTokenSpanExcludingCaching parts of ColdFusion pages in Optimizing ColdFusion applications in the Developing ColdFusion Applications

Parameters

Parameter
Description
string
A string or a variable that contains the search string.
set
A string or a variable that contains a set of characters. Must contain one or more characters.

Example

<cfscript>
    string="Highway star"
    strToset="High"
    writeOutput(SpanIncluding(string,strToset)) // High
</cfscript>

Share this page

Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.

On this page