The fn:replace() function
The fn:replace() function replaces all specified substrings in a string with another string.
Syntax
The syntax of the fn:replace() function is as follows:
${fn:replace(<原始字符串>, <被替换的字符串>, <要替换的字符串>)}
Example Demonstration
The following example demonstrates the function:
<%@ 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" %>
使用 JSTL 函数
替换后的字符串 : ${string2}
The result is as follows::
替换后的字符串 : I am from runoob
JSP Standard Tag Library