Substring in jsp

Below is the JSP code which will show the implementation of substring.

String employeeID="9000034557";
String subStringEmpID="";

//Checking the length of a string

if(employeeID.length() >= 4)
      {
        subStringEmpID = employeeID.substring(0, 4);
      }


//Output=9000


Restricting users whose employeeid starts with 9000

        if (!"9000".equals(subStringEmpID)) {
   
        //Write your code here   

    }
    else
    {

        //Write your code here   

    }

No comments:

Post a Comment