Solved

left and len

Posted on 2004-09-16
3
1,000 Views
Last Modified: 2006-11-17
hi everbody
i want to use left and len function but
i don't know syntax these function
could yo tell me how use ..
and which do i improt cllass my jsp page ?
0
Comment
Question by:skychan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 5

Expert Comment

by:KarcOrigin
ID: 12082099
String str = new String("Test");

' Will give you the length of the string
str.length()

There is no Left function in JSP. Rather you can use
substring(intBeginIndex)
Or
substring(intBeginIndex, intEndIndex)

I hope it will give you some idea.
Thanks
0
 

Author Comment

by:skychan
ID: 12082298
String str = new String("Test");

out.println (str.length()) ;

ok but

subinteger('1232232', str.lenght());
problem
0
 
LVL 5

Accepted Solution

by:
KarcOrigin earned 30 total points
ID: 12082463
Do like this:

To apply the left function you can use substring() funtion of String class.

The substring(int, int) method is used for extracting a contiguous portion of a string. The first integer represents the starting index, the second integer is the ending index. You can also use substring(int) function which will take the starting index of your string and the ending index will be considered as length of the string.

Question: Why you have used subinteger() function??

The santax example of substring function is as follows -

String str = new String("Testing Game");
str.substring(0,6) will return
Testing
You can also use str.substring(6) Which will return "Game" to you.

Good luck.

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Running Java Servlet inside Eclipse Luna 6 168
constructor overloading 2 93
maven disable workspace resolution 1 38
jsp error 6 45
This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
This article demonstrates probably the easiest way to configure domain-wide tier isolation within Active Directory. If you do not know tier isolation read https://technet.microsoft.com/en-us/windows-server-docs/security/securing-privileged-access/s…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question