|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
|
#2
|
||||
|
||||
|
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();
}
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > Java Development > problem in the displaying two strings |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|