<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> JSTL: Functions

fn:contains

Input String Substring Result
${s1} castle ${fn:contains(s1, "castle")}
${s1} CASTLE ${fn:contains(s1, "CASTLE")}
${s1} null ${fn:contains(s1, undefined)}
${s1} empty ${fn:contains(s1, "")}
null castle ${fn:contains(undefined, "castle")}
null empty ${fn:contains(undefined, "")}

fn:containsIgnoreCase

Input String Substring Result
${s1} castle ${fn:containsIgnoreCase(s1, "castle")}
${s1} CASTLE ${fn:containsIgnoreCase(s1, "CASTLE")}
${s1} CaStLe ${fn:containsIgnoreCase(s1, "CaStLe")}
${s1} null ${fn:containsIgnoreCase(s1, undefined)}
${s1} empty ${fn:containsIgnoreCase(s1, "")}
null castle ${fn:containsIgnoreCase(undefined, "castle")}
null empty ${fn:containsIgnoreCase(undefined, "")}

fn:startsWith

Input String Substring Result
${s1} castle ${fn:startsWith(s1, "castle")}
${s1} There is ${fn:startsWith(s1, "There is")}
${s1} null ${fn:startsWith(s1, undefined)}
${s1} empty ${fn:startsWith(s1, "")}
null castle ${fn:startsWith(undefined, "castle")}
null empty ${fn:startsWith(undefined, "")}

fn:endsWith

Input String Substring Result
${s1} castle ${fn:endsWith(s1, "castle")}
${s1} cloud ${fn:endsWith(s1, "cloud")}
${s1} null ${fn:endsWith(s1, undefined)}
${s1} empty ${fn:endsWith(s1, "")}
null castle ${fn:endsWith(undefined, "castle")}
null empty ${fn:endsWith(undefined, "")}

fn:indexOf

Input String Substring Result
${s1} castle ${fn:indexOf(s1, "castle")}
${s1} cloud ${fn:indexOf(s1, "cloud")}
${s1} null ${fn:indexOf(s1, undefined)}
${s1} empty ${fn:indexOf(s1, "")}
null castle ${fn:indexOf(undefined, "castle")}
null empty ${fn:indexOf(undefined, "")}

fn:substring

Input String beginIndex endIndex Result
${s1} 11 17 ${fn:substring(s1, 11, 17)}
${s1} 23 -1 ${fn:substring(s1, 23, -1)}
${s1} -1 -1 ${fn:substring(s1, -1, -1)}
empty 0 6  ${fn:substring("", 0, 6)}
empty 2 6  ${fn:substring("", 2, 6)}

fn:substringAfter

Input String substring Result
${s1} There ${fn:substringAfter(s1, "There")}
${s1} on a ${fn:substringAfter(s1, "on a")}
${s1} not found  ${fn:substringAfter(s1, "not found")}
${s1} null ${fn:substringAfter(s1, undefined)}
${s1} empty ${fn:substringAfter(s1, "")}
null castle  ${fn:substringAfter(undefined, "castle")}
null empty  ${fn:substringAfter(undefined, "")}

fn:substringBefore

Input String substring Result
${s1} on a ${fn:substringBefore(s1, "on a")}
${s1} castle ${fn:substringBefore(s1, "castle")}
${s1} null  ${fn:substringBefore(s1, undefined)}
${s1} empty  ${fn:substringBefore(s1, "")}
null castle  ${fn:substringBefore(undefined, "castle")}
null empty  ${fn:substringBefore(undefined, "")}

fn:escapeXml

Input String Result
${s1} ${fn:escapeXml(s1)}
body of foo ${fn:escapeXml("body of foo")}
null  ${fn:escapeXml(undefined)}
empty  ${fn:escapeXml("")}

fn:trim

Input String Result
${s1} ${fn:trim(s1)}
    3 spaces before and after   
${fn:trim("    3 spaces before and after   ")}
null  ${fn:trim(undefined)}
empty  ${fn:trim("")}

fn:length

Input String Result
${s1} ${fn:length(s1)}
${customers} ${fn:length(customers)}
null ${fn:length(undefined)}
empty ${fn:length("")}

fn:toLowerCase

Input String Result
${s1} ${fn:toLowerCase(s1)}
null  ${fn:toLowerCase(undefined)}
empty  ${fn:toLowerCase("")}

fn:toUpperCase

Input String Result
${s1} ${fn:toUpperCase(s1)}
null  ${fn:toUpperCase(undefined)}
empty  ${fn:toUpperCase("")}