Whatever message this page gives is out now! Go check it out!
ListFindNoCase(list, value [, delimiters, includeEmptyFields ])Parameter | Description |
includeEmptyValues | Optional. Set to yes to include empty values. |
list | A list or a variable that contains one. |
value | Number or string for which to search. The search is case-insensitive. |
delimiters | A string or a variable that contains one. Characters that separate list elements. The default value is comma. If this parameter contains more than one character, ColdFusion processes each occurrence of each character as a delimiter. |
<cfscript>
myList="Tokyo,Bangkok,bangkok,bangKok,Jakarta,Manila,Bangalore,Shanghai";
myFind=ListFindNoCase(myList,"bangkok");
WriteOutput(myFind); // Returns 2
</cfscript><cfscript>
// Simple Knowledge Base Search with ListFindNoCase
// Business: Customer support portal with case-insensitive help topic search
// Available help topics (standardized format)
helpTopics = "Installation,Configuration,Troubleshooting,API,Database,Security,Performance";
// User searches (various case formats from different interfaces)
userSearches = [
{"query": "installation", "user": "Mobile User"},
{"query": "API", "user": "Developer"},
{"query": "database", "user": "Admin"},
{"query": "SECURITY", "user": "Manager"},
{"query": "troubleshooting", "user": "Support Agent"}
];
// Auto-suggest function
function getHelpSuggestions(searchTerm, topicList) {
local.suggestions = [];
local.topicArray = ListToArray(topicList);
for (local.topic in local.topicArray) {
if (FindNoCase(searchTerm, local.topic) > 0) {
ArrayAppend(local.suggestions, local.topic);
}
}
return local.suggestions;
}
</cfscript>
<cfoutput>
<h1>📚 ListFindNoCase: Knowledge Base Search Demo</h1>
<p><strong>Business Need:</strong> Help users find support articles regardless of how they type search terms</p>
<p><strong>Challenge:</strong> Users type in different cases - "api", "API", "Api" should all work</p>
<p><strong>Solution:</strong> Use ListFindNoCase() for flexible topic matching</p>
<hr>
<h2>Available Help Topics</h2>
<div style="background: ##f8f9fa; padding: 15px; border: 1px solid ##ddd; margin: 10px 0;">
<p><strong>Topics:</strong> #helpTopics#</p>
<p><em>Users can search for any topic using any capitalization</em></p>
</div>
<h2>User Search Results</h2>
</cfoutput>
<cfloop array="#userSearches#" index="search">
<cfscript>
// Use ListFindNoCase for exact topic matching
topicPosition = ListFindNoCase(helpTopics, search["query"]);
isExactMatch = topicPosition > 0;
// Get auto-suggest results for partial matches
suggestions = getHelpSuggestions(search["query"], helpTopics);
</cfscript>
<cfoutput>
<div style="background: #isExactMatch ? '##d4edda' : (ArrayLen(suggestions) GT 0 ? '##fff3cd' : '##f8d7da')#; padding: 15px; margin: 10px 0; border-radius: 5px;">
<h3>#search["user"]# searches for: "#search["query"]#"</h3>
<cfif isExactMatch>
<p>✅ <strong>Exact Topic Match Found!</strong></p>
<p>Topic: <strong>#ListGetAt(helpTopics, topicPosition)#</strong></p>
<p>Position in List: #topicPosition#</p>
<p>🔗 <em>Redirecting to help article...</em></p>
<cfelseif ArrayLen(suggestions) GT 0>
<p>📝 <strong>Similar Topics Available:</strong></p>
<p>Suggestions: <strong>#ArrayToList(suggestions)#</strong></p>
<p>💡 <em>Did you mean one of these topics?</em></p>
<cfelse>
<p>❌ <strong>No matches found</strong></p>
<p>Try searching for: Installation, Configuration, Troubleshooting, API, Database, Security, or Performance</p>
</cfif>
</div>
</cfoutput>
</cfloop>
<cfscript>
// Calculate search success statistics
exactMatches = 0;
partialMatches = 0;
noMatches = 0;
for (search in userSearches) {
topicFound = ListFindNoCase(helpTopics, search["query"]) > 0;
suggestions = getHelpSuggestions(search["query"], helpTopics);
if (topicFound) {
exactMatches++;
} else if (ArrayLen(suggestions) > 0) {
partialMatches++;
} else {
noMatches++;
}
}
totalSearches = ArrayLen(userSearches);
successRate = totalSearches > 0 ? Round(((exactMatches + partialMatches) / totalSearches) * 100) : 0;
</cfscript>
<cfoutput>
<h2>📊 Search Analytics</h2>
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 15px; margin: 20px 0;">
<div style="background: ##e8f5e8; padding: 15px; text-align: center; border-radius: 5px;">
<h3>Exact Matches</h3>
<h2 style="color: green;">#exactMatches#</h2>
</div>
<div style="background: ##fff8dc; padding: 15px; text-align: center; border-radius: 5px;">
<h3>Partial Matches</h3>
<h2 style="color: orange;">#partialMatches#</h2>
</div>
<div style="background: ##ffe4e1; padding: 15px; text-align: center; border-radius: 5px;">
<h3>No Matches</h3>
<h2 style="color: red;">#noMatches#</h2>
</div>
<div style="background: ##e3f2fd; padding: 15px; text-align: center; border-radius: 5px;">
<h3>Success Rate</h3>
<h2 style="color: blue;">#successRate#%</h2>
</div>
</div>
</cfoutput><cfscript>
// Simple E-Commerce Category Filter with ListFindNoCase
// Business: Online store with case-insensitive product category filtering
// Available product categories (standardized format)
categories = "Electronics,Fashion,Home,Sports,Books,Automotive,Health,Beauty";
// Customer filter selections (various cases from different interfaces)
customerFilters = [
{"filter": "electronics", "source": "Mobile App", "customer": "John Smith"},
{"filter": "FASHION", "source": "Desktop (Caps Lock)", "customer": "Mary Johnson"},
{"filter": "Home", "source": "Voice Search", "customer": "Alex Chen"},
{"filter": "sports", "source": "Search Bar", "customer": "Sarah Wilson"},
{"filter": "BEAUTY", "source": "Category Menu", "customer": "Mike Brown"}
];
// Function to simulate product counts per category
function getProductCount(categoryName) {
switch(categoryName) {
case "Electronics": return 1247;
case "Fashion": return 892;
case "Home": return 634;
case "Sports": return 456;
case "Books": return 2145;
case "Automotive": return 378;
case "Health": return 523;
case "Beauty": return 689;
default: return 0;
}
}
</cfscript>
<cfoutput>
<h1>🛍️ ListFindNoCase: E-Commerce Category Filter Demo</h1>
<p><strong>Business Need:</strong> Allow customers to filter products by category regardless of typing case</p>
<p><strong>Challenge:</strong> Mobile auto-capitalize, caps lock, and different typing styles create case variations</p>
<p><strong>Solution:</strong> Use ListFindNoCase() for flexible category matching</p>
<hr>
<h2>Available Product Categories</h2>
<div style="background: ##f8f9fa; padding: 15px; border: 1px solid ##ddd; margin: 10px 0;">
<p><strong>Categories:</strong> #categories#</p>
<p><em>Customers can filter by any category name using any capitalization</em></p>
</div>
<h2>Customer Filter Processing</h2>
</cfoutput>
<cfloop array="#customerFilters#" index="customerFilter">
<cfscript>
// Use ListFindNoCase to validate category filter
categoryPosition = ListFindNoCase(categories, customerFilter["filter"]);
isValidCategory = categoryPosition > 0;
if (isValidCategory) {
// Get properly formatted category name and product count
properCategoryName = ListGetAt(categories, categoryPosition);
productCount = getProductCount(properCategoryName);
} else {
properCategoryName = "";
productCount = 0;
}
</cfscript>
<cfoutput>
<div style="background: #isValidCategory ? '##d4edda' : '##f8d7da'#; padding: 15px; margin: 10px 0; border-radius: 5px;">
<h3>🛒 Customer: #customerFilter["customer"]#</h3>
<p><strong>Platform:</strong> #customerFilter["source"]#</p>
<p><strong>Filter Input:</strong> "#customerFilter["filter"]#"</p>
<cfif isValidCategory>
<p>✅ <strong>Valid Category Filter!</strong></p>
<p>Matched Category: <strong>#properCategoryName#</strong></p>
<p>Category Position: #categoryPosition#</p>
<p>📦 Products Available: <strong>#NumberFormat(productCount, "999,999")#</strong></p>
<p>🎯 <em>Showing products in #properCategoryName# category...</em></p>
<cfelse>
<p>❌ <strong>Invalid Category Filter</strong></p>
<p>Filter "#customerFilter["filter"]#" not found in available categories</p>
<p>💡 <em>Showing all products instead or suggesting similar categories</em></p>
</cfif>
</div>
</cfoutput>
</cfloop>
<cfscript>
// Calculate filter processing statistics
validFilters = 0;
totalProducts = 0;
for (filter in customerFilters) {
position = ListFindNoCase(categories, filter["filter"]);
if (position > 0) {
validFilters++;
categoryName = ListGetAt(categories, position);
totalProducts += getProductCount(categoryName);
}
}
totalCustomers = ArrayLen(customerFilters);
filterSuccessRate = totalCustomers > 0 ? Round((validFilters / totalCustomers) * 100) : 0;
</cfscript>
<cfoutput>
<h2>📊 Category Filter Analytics</h2>
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 15px; margin: 20px 0;">
<div style="background: ##e8f5e8; padding: 15px; text-align: center; border-radius: 5px;">
<h3>Total Filters</h3>
<h2 style="color: blue;">#totalCustomers#</h2>
</div>
<div style="background: ##d4edda; padding: 15px; text-align: center; border-radius: 5px;">
<h3>Valid Filters</h3>
<h2 style="color: green;">#validFilters#</h2>
</div>
<div style="background: ##fff8dc; padding: 15px; text-align: center; border-radius: 5px;">
<h3>Success Rate</h3>
<h2 style="color: orange;">#filterSuccessRate#%</h2>
</div>
<div style="background: ##e3f2fd; padding: 15px; text-align: center; border-radius: 5px;">
<h3>Products Found</h3>
<h2 style="color: purple;">#NumberFormat(totalProducts, "999,999")#</h2>
</div>
</div>
<h2>🎯 Real-World Category Matching</h2>
<div style="background: ##f8f9fa; padding: 15px; border: 1px solid ##ddd; margin: 10px 0;">
<p><strong>Common Customer Input Variations:</strong></p>
<ul>
<li><strong>"electronics"</strong> (lowercase) → Matches "Electronics"</li>
<li><strong>"FASHION"</strong> (caps lock) → Matches "Fashion"</li>
<li><strong>"Home"</strong> (proper case) → Matches "Home"</li>
<li><strong>"sports"</strong> (mobile typing) → Matches "Sports"</li>
<li><strong>"BEAUTY"</strong> (tablet caps) → Matches "Beauty"</li>
</ul>
</div>
</cfoutput><cfscript>
// Simple Employee Directory Department Search with ListFindNoCase
// Business: Corporate directory with case-insensitive department and role lookup
// Company departments (standardized format from HR system)
companyDepartments = "Engineering,Marketing,Sales,HR,Finance,Operations,Legal,Support";
// Employee roles (standard job classifications)
employeeRoles = "Manager,Director,Analyst,Developer,Designer,Coordinator,Specialist,Associate";
// Directory search requests (from various internal systems and user interfaces)
directorySearches = [
{"query": "engineering", "type": "department", "searcher": "New Employee", "purpose": "Team Contact"},
{"query": "MARKETING", "type": "department", "searcher": "Project Manager", "purpose": "Collaboration"},
{"query": "manager", "type": "role", "searcher": "HR Recruiter", "purpose": "Org Chart"},
{"query": "DEVELOPER", "type": "role", "searcher": "Team Lead", "purpose": "Resource Planning"},
{"query": "Sales", "type": "department", "searcher": "Partner", "purpose": "Business Contact"}
];
// Function to simulate employee counts by department/role
function getEmployeeCount(searchType, searchValue) {
if (searchType == "department") {
switch(searchValue) {
case "Engineering": return 145;
case "Marketing": return 32;
case "Sales": return 67;
case "HR": return 18;
case "Finance": return 25;
case "Operations": return 42;
case "Legal": return 8;
case "Support": return 28;
default: return 0;
}
} else if (searchType == "role") {
switch(searchValue) {
case "Manager": return 45;
case "Director": return 12;
case "Analyst": return 38;
case "Developer": return 89;
case "Designer": return 24;
case "Coordinator": return 16;
case "Specialist": return 31;
case "Associate": return 52;
default: return 0;
}
}
return 0;
}
</cfscript>
<cfoutput>
<h1>🏢 ListFindNoCase: Employee Directory Search Demo</h1>
<p><strong>Business Need:</strong> Enable flexible employee directory searches by department and role</p>
<p><strong>Challenge:</strong> Users search using different case formats across multiple systems and interfaces</p>
<p><strong>Solution:</strong> Use ListFindNoCase() for case-insensitive directory lookup</p>
<hr>
<h2>Corporate Directory Structure</h2>
<div style="background: ##f8f9fa; padding: 15px; border: 1px solid ##ddd; margin: 10px 0;">
<p><strong>Departments:</strong> #companyDepartments#</p>
<p><strong>Roles:</strong> #employeeRoles#</p>
<p><em>Directory searches work with any capitalization format</em></p>
</div>
<h2>Directory Search Results</h2>
</cfoutput>
<cfloop array="#directorySearches#" index="search">
<cfscript>
// Use ListFindNoCase to find department or role
if (search["type"] == "department") {
searchPosition = ListFindNoCase(companyDepartments, search["query"]);
searchList = companyDepartments;
} else {
searchPosition = ListFindNoCase(employeeRoles, search["query"]);
searchList = employeeRoles;
}
isFound = searchPosition > 0;
if (isFound) {
matchedValue = ListGetAt(searchList, searchPosition);
employeeCount = getEmployeeCount(search["type"], matchedValue);
} else {
matchedValue = "";
employeeCount = 0;
}
</cfscript>
<cfoutput>
<div style="background: #isFound ? '##d4edda' : '##f8d7da'#; padding: 15px; margin: 10px 0; border-radius: 5px;">
<h3>👤 Search Request from: #search["searcher"]#</h3>
<p><strong>Search Type:</strong> #UCase(Left(search["type"], 1)) & LCase(Right(search["type"], Len(search["type"])-1))# | <strong>Purpose:</strong> #search["purpose"]#</p>
<p><strong>Search Query:</strong> "#search["query"]#"</p>
<cfif isFound>
<div style="margin: 10px 0;">
<p>✅ <strong>#search["type"] == "department" ? "Department" : "Role"# Found!</strong></p>
<p>Matched #search["type"] == "department" ? "Department" : "Role"#: <strong>#matchedValue#</strong></p>
<p>Directory Position: #searchPosition#</p>
<p>👥 Employees Found: <strong>#NumberFormat(employeeCount)#</strong></p>
<p>🔗 <em>Click to view employee list with contact information and organizational details</em></p>
</div>
<cfif search["purpose"] == "Team Contact">
<p>📞 <em>Showing team leads and direct contact information</em></p>
<cfelseif search["purpose"] == "Collaboration">
<p>🤝 <em>Displaying project managers and collaboration tools</em></p>
<cfelseif search["purpose"] == "Org Chart">
<p>📊 <em>Generating organizational hierarchy and reporting structure</em></p>
<cfelseif search["purpose"] == "Resource Planning">
<p>📋 <em>Showing skill sets and availability for project assignment</em></p>
<cfelseif search["purpose"] == "Business Contact">
<p>💼 <em>Providing external contact information and business cards</em></p>
</cfif>
<cfelse>
<p>❌ <strong>#search["type"] == "department" ? "Department" : "Role"# Not Found</strong></p>
<p>Search term "#search["query"]#" did not match any #search["type"]#</p>
<cfif search["type"] == "department">
<p>💡 <em>Available Departments: Engineering, Marketing, Sales, HR, Finance, Operations, Legal, Support</em></p>
<cfelse>
<p>💡 <em>Available Roles: Manager, Director, Analyst, Developer, Designer, Coordinator, Specialist, Associate</em></p>
</cfif>
</cfif>
</div>
</cfoutput>
</cfloop>
<cfscript>
// Calculate directory search statistics
departmentSearches = 0;
roleSearches = 0;
successfulSearches = 0;
totalEmployeesFound = 0;
for (search in directorySearches) {
if (search["type"] == "department") {
departmentSearches++;
position = ListFindNoCase(companyDepartments, search["query"]);
if (position > 0) {
successfulSearches++;
matchedDept = ListGetAt(companyDepartments, position);
totalEmployeesFound += getEmployeeCount("department", matchedDept);
}
} else {
roleSearches++;
position = ListFindNoCase(employeeRoles, search["query"]);
if (position > 0) {
successfulSearches++;
matchedRole = ListGetAt(employeeRoles, position);
totalEmployeesFound += getEmployeeCount("role", matchedRole);
}
}
}
totalSearches = ArrayLen(directorySearches);
searchSuccessRate = totalSearches > 0 ? Round((successfulSearches / totalSearches) * 100) : 0;
</cfscript>
<cfoutput>
<h2>📊 Directory Search Analytics</h2>
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 15px; margin: 20px 0;">
<div style="background: ##e8f5e8; padding: 15px; text-align: center; border-radius: 5px;">
<h3>Dept Searches</h3>
<h2 style="color: blue;">#departmentSearches#</h2>
</div>
<div style="background: ##fff8dc; padding: 15px; text-align: center; border-radius: 5px;">
<h3>Role Searches</h3>
<h2 style="color: orange;">#roleSearches#</h2>
</div>
<div style="background: ##d4edda; padding: 15px; text-align: center; border-radius: 5px;">
<h3>Success Rate</h3>
<h2 style="color: green;">#searchSuccessRate#%</h2>
</div>
<div style="background: ##e3f2fd; padding: 15px; text-align: center; border-radius: 5px;">
<h3>Employees Found</h3>
<h2 style="color: purple;">#NumberFormat(totalEmployeesFound)#</h2>
</div>
</div>
<h2>🎯 Case Flexibility Examples</h2>
<div style="background: ##f8f9fa; padding: 15px; border: 1px solid ##ddd; margin: 10px 0;">
<p><strong>How ListFindNoCase() Handles Corporate Directory Searches:</strong></p>
<ul>
<li><strong>"engineering"</strong> (lowercase) → Finds "Engineering" department (145 employees)</li>
<li><strong>"MARKETING"</strong> (uppercase) → Finds "Marketing" department (32 employees)</li>
<li><strong>"manager"</strong> (lowercase) → Finds "Manager" role (45 employees)</li>
<li><strong>"DEVELOPER"</strong> (caps lock) → Finds "Developer" role (89 employees)</li>
<li><strong>"Sales"</strong> (proper case) → Finds "Sales" department (67 employees)</li>
</ul>
</div>
</cfoutput>