File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes substring Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "substring" Watch "substring" New topic
Author

substring

smitha mano
Ranch Hand

Joined: Sep 26, 2005
Posts: 70
i have EMP database in a field history contains 500 charactes.
i want to display first 125 characters
How to do this using Java?
Ravi Shankar R
Greenhorn

Joined: Jan 05, 2005
Posts: 7
Hi,

public class DemoDisplay {

public static void main(String[] args) {
// Let this be the output String retrieved from the database EMP
String word = "123456789";
int worldLenght = word.length();
int end = worldLenght - (worldLenght - 3);
// Would retieve the first 3 characters of the String word.
String sub = word.substring(0, end);
System.out.println("sub :: " + sub);
}
}

I hope this helps you ......

With Regards,
Ravi.
smitha mano
Ranch Hand

Joined: Sep 26, 2005
Posts: 70
thanks very much
 
Consider Paul's rocket mass heater.
 
subject: substring
 
Similar Threads
Cant use object from another class
WA #1.....word association
Posting to bump up my count...
Text box value is not being completely filled with request attribute
The x900 effect ?