tl  tr
  Home | Tutorials | Articles | Videos | Products | Tools | Search
Interviews | Open Source | Tag Cloud | Follow Us | Bookmark | Contact   
 Spring > Expression Language > String Case

String Case 

The Spring Expression Language (SpEL) is a simple and powerful expression language which helps to query and manipulate objects at runtime. The following example shows string case change using SpEL. We can also invoke other instance methods in similar way.

File Name  :  
Author  :  Sudhakar KV
Email  :  [email protected]
package com.bethecoder.tutorials.spring3.tests.spel;

import org.springframework.expression.Expression;
import org.springframework.expression.ExpressionParser;
import org.springframework.expression.spel.standard.SpelExpressionParser;

public class StringCaseTest {

   @param args
  public static void main(String[] args) {

    ExpressionParser parser = new SpelExpressionParser();
    Expression exp = parser.parseExpression("'be the coder'.toUpperCase()");
    String message = exp.getValue(String.class);

    exp = parser.parseExpression("'BE THE CODER'.toLowerCase()");
    message = exp.getValue(String.class);


It gives the following output,
be the coder


bl  br