JSTL fn:toUpperCase() 函数将指定字符串中的所有字符转为大写。
JSP fn:toUpperCase() 函数的语法如下。
- String fn:toUpperCase(String sourceStr)
其中,sourceStr 为指定的字符串。
下面为 fn:toUpperCase() 函数的简单实例。
- <%@ 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"%>
- <!DOCTYPE html>
- <html>
- <head>
- <title>城东书院(www.cdsy.xyz)</title>
- </head>
- <body>
- <c:set var="msg" value="Welcome to cdsy" />
- ${fn:toUpperCase(msg)}
- </body>
- </html>
页面输出内容如下: