Solved

left and len

Posted on 2004-09-16
3
1,013 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

In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Resolving an irritating Remote Desktop connection that stops your saved credentials from being used.
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

726 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