jrthor2
02-09-2007, 02:39 PM
If i have a string that has 5000 characters in it from my database, when I display that to the user, how can I only show, for example, the first 200 characters?
thanks
thanks
|
Click to See Complete Forum and Search --> : display x number of characters jrthor2 02-09-2007, 02:39 PM If i have a string that has 5000 characters in it from my database, when I display that to the user, how can I only show, for example, the first 200 characters? thanks Veerasekar 02-10-2007, 03:28 AM Hello jrthor2, I dont know, which database are you using. Anyway, I wrote a program for your reuirement. Its may be helpful for you. class PickXCharacters{ public static void main(String args[]) { // Assign a String data in to String Variable //If you are using a Database, Get a Data from DB and Assign into the // String Variable String strData= "The UN security council criticised President Rajapakse for destroying"+ "the 2002 truce by trying to reoccupy the areas recognised as "+ "under Tiger control."; // Gets first 50 characters from the String String strPick=strData.substring(0, 49); System.out.println("First 50 Characters as follows => "+strPick); } } PanchatcharamVeerasekar ClimbInc,Tokyo,Japan webdeveloper.com
Copyright Internet.com Inc., All Rights Reserved. |