Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

JSTL fn:split() Function

The fn:split() function

JSP Standard Label LibraryJSP Standard Tag Library

fn:split() The function splits a string into an array of substrings using a specified delimiter.

Syntax

The syntax of the fn:split() function is as follows:



${fn:split(<待分隔的字符串>, <分隔符>)}

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 函数















string3 字符串 : ${string3}

string5 字符串: ${string5}

The running result is as follows:



string3 字符串 : www-runoob-com



string5 字符串: www runoob com


JSP Standard Label LibraryJSP Standard Tag Library