Java Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingJava Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old March 15th, 2005, 04:54 AM
abhit_kumar abhit_kumar is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 22 abhit_kumar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 m 3 sec
Reputation Power: 0
problem in the displaying two strings

i have two two field 1)select type options 2) input type text..in first page...

first page:-

Code:
Voucher Type:<SELECT name="voucher_type"><option value="" selected></option><option VALUE="BP">BP</option><option VALUE="BR">BR</option><option VALUE="JV">JV</option></select>
<br>
Voucher No.:<input type="text" name="voucherno" size="4" >


in second page, i want that it display Voucher Type+Voucher No..

for example when i enter values in Voucher Type is BP and Voucher No. is 1...it should be display as BP0001...

if i enter Voucher No. is 2.. then it displays BP0002.....vice versa..

Note that: if i enter 1 then it would be 0001
if 10 then it would display 0010,
if 100 then 0100,
if 1000 then same 1000

Note that it wuld join the Voucher Type and Voucher No...

for ex--BP0001, BP0010, BP0120, BP1500

help me...

abhi

Reply With Quote
  #2  
Old March 18th, 2005, 05:00 AM
gertcuppens's Avatar
gertcuppens gertcuppens is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 118 gertcuppens User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 h 28 m 17 sec
Reputation Power: 14
with the leading zeroes, I might give you a hand. I have done something
similar with the property "filmnummer" of my java class Film.

The method getFilmnummer is changed so that it produces leading zeroes
whenevery necessary.

Code:
public String getFilmnummer() {
Integer filmnummerInt = new Integer(this.filmnummer);
String filmnummerStr = filmnummerInt.toString(); 
//System.out.println("filmnr als string is >" + filmnummerStr + "<"); 
//System.out.println("lengte van filmnummer is " + filmnummerStr.length()); 
StringBuffer filmnummerBuffer = new StringBuffer();
switch (filmnummerStr.length())
{
case 1 : filmnummerBuffer.append("00");
	 filmnummerBuffer.append(filmnummerStr);
	 break;
case 2 : filmnummerBuffer.append("0");
	 filmnummerBuffer.append(filmnummerStr);
	 break;
default : filmnummerBuffer.append(filmnummerStr); 
	 break;
 
} /* switch */
//System.out.println("filmnummerBuffer is" + filmnummerBuffer.toString());
 
 
return filmnummerBuffer.toString();
}

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJava Development > problem in the displaying two strings


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap