Skip to content

Latest commit

 

History

History
38 lines (27 loc) · 1.35 KB

30.md

File metadata and controls

38 lines (27 loc) · 1.35 KB

fn:toUpperCase() - JSTL 函数

原文: https://beginnersbook.com/2013/12/fn-touppercase-jstl-function/

它与fn:toLowerCase()函数正好相反。它将输入字符串转换为大写字符串。输入字符串的所有字符都被替换为相应的大写字符。需要更改的字符串作为函数的参数提供,并且函数返回转换后的字符串。我们可以将字符串作为变量传递,或者只是在函数调用期间对其进行硬编码。

语法

String fn:toUpperCase(String input)

它将输入字符串转换为大写后返回String

fn:toUpperCase()的示例

在这里,我们使用该函数将少量字符串转换为其大写字母。

<%@ 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>fn:toUpperCase() example</title>
</head>
<body>
  <c:set var="site" value="BeginnersBook.com"/>
  <c:set var="author" value="Chaitanya"/>
  Hi This is ${fn:toUpperCase(author)} from ${fn:toUpperCase(site)}.
</body>
</html>

输出:

字符串"author""site"被所有大写字母替换。

fn-toUpperCase-example