943,563 Members | Top Members by Rank

Ad:
  • JSP Discussion Thread
  • Marked Solved
  • Views: 693
  • JSP RSS
Feb 8th, 2009
0

String

Expand Post »
Hi iwould like to check if there is any function that allows me to take the last 4 char or a String? Or the 1st two char of a String? I require this because i require to have a auto increase product id. Example current productid stops at WA0059. When admin goes to add new product page, WA0060 should be filled into the productid box automatically. THis is to ensure the naming convention is consistent. Any suggestion how to implement this?
Similar Threads
Reputation Points: 10
Solved Threads: 1
Light Poster
dreamer14 is offline Offline
31 posts
since Sep 2008
Feb 9th, 2009
1

Re: String

This is more of a core java question, So it should have been posted in the Java forum.
Anyways take a look at the javadocs of the String and StringBuffer class you might find what you are looking for there, most probably it is the substring (1,2) menthod..
Featured Poster
Reputation Points: 653
Solved Threads: 151
Nearly a Posting Virtuoso
stephen84s is offline Offline
1,316 posts
since Jul 2007
Feb 12th, 2009
0

Re: String

Oo my bad reali should be at java forum. Anyway i maaged to solve it thx for the help.
JSP Syntax (Toggle Plain Text)
  1. String t122="AA0001";
  2. char t22=t122.charAt(5);
  3. String t32=String.valueOf(t22);
  4. char t42=t122.charAt(4);
  5. String t312=String.valueOf(t42);
  6. String t4112=t312+t32;
  7. int t412=Integer.parseInt(t4112);
Reputation Points: 10
Solved Threads: 1
Light Poster
dreamer14 is offline Offline
31 posts
since Sep 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in JSP Forum Timeline: How to upload images in JSP?
Next Thread in JSP Forum Timeline: Some issues with WAR deployment





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC