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

SpanExcluding

Last update:
May 18, 2026

Description

Gets characters from a string_,_ from the beginning and stops when it encounters any of the characters in a specified set of characters. The search is case sensitive. For example, SpanExcluding("MyString", "inS") excludes "String" from "MyString" and returns "My". Because, in the string "MyString", after "My", the character 'S' (which is present in the second string "inS") is encountered.

Returns

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

Category

Function syntax

SpanExcluding(string, set)

See also

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

Parameters

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

Example

<cfscript>
    string="Highway star"
    strToset="st"
    writeOutput(SpanExcluding(string,strToset)) // Highway
</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