English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

JSTL fn:containsIgnoreCase() Funktion

JSP-Standard-Tag-Bibliothek

Die Funktion fn:containsIgnoreCase() wird verwendet, um zu bestimmen, ob eine Zeichenkette eine bestimmte Unterzeichenkette enthält, ohne auf Groß- und Kleinschreibung zu achten.

Syntax

Die Syntax der fn:containsIgnoreCase()-Funktion ist wie folgt:

<c:if test="${fn:containsIgnoreCase(<OriginalString>, <ZuSuchenderZeichenfolge>)}">
...
</c:if>

Beispiel-Demonstration

Nachfolgender Beispiel zeigt die Funktion dieses Funktions

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<html>
<head>
<title>Verwendung von JSTL-Funktionen</title>
</head>
<body>
<c:set var="theString" value="Ich komme von w3codebox"/>
<c:if test="${fn:containsIgnoreCase(theString, 'w3codebox')}>
   <p>w gefunden3codebox<p>
</c:if>
<c:if test="${fn:containsIgnoreCase(theString, 'w3codebox')}>
     <p>w gefunden3codebox<p>
</c:if>
</body>
</html>

Ausführungsergebnis:

w gefunden3codebox
w gefunden3codebox

JSP-Standard-Tag-Bibliothek