Name

fn:startsWith

Synopsis

This function tests if a string starts with a specific prefix and returns true if it does, otherwise false.

Syntax

boolean: fn:startsWith(string, prefix)

Parameters

Parameter name

Java type

Description

string
String

The string to test.

prefix
String

The prefix to look for.

Example

<c:if test="${fn:startsWith(fn:toUpperCase(param:day), 'THU')}">
  It must be Thursday!
</c:if>

Get JavaServer Pages, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.