Solved

left and len

Posted on 2004-09-16
3
965 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
  • 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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Moving applications to the cloud or switching services to cloud-based ones, is a stressful job.  Here's how you can make it easier.
What is Backup? Backup software creates one or more copies of the data on your digital devices in case your original data is lost or damaged. Different backup solutions protect different kinds of data and different combinations of devices. For e…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

744 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now