luni, 7 septembrie 2015

[OmniFaces utilities 2.0] Capitalize the given string, i.e. uppercase the first character


[OmniFaces utilities] The capitalize() function capitalize the given string, i.e. uppercase the first character.

Function:
Usage:

Using of:capitalize() function is pretty straightforward. Let's suppose that we have the following text in a managed bean named, HelloBean:

private String hello = "hello, guest!";
...
public String getHello() {
 return hello;
}

Now, in a JSF page, we can quickly capitalize this text as, Hello, guest! via the of:capitalize() function:

#{of:capitalize(testBean.hello)}

Of course, you can use hard-coded strings also:

#{of:capitalize('hello, guest!')}

Niciun comentariu:

Trimiteți un comentariu