Show the id in 5 Digits
-
Hiii everyone Actually i am geting memberid from database as 1,2,123,124 but i want to amend the id as 00001,00002,00123 etc. Anyone can suggest me how i can get it. using array or any collection. Thanks in advance Gaurav Gupta
-
Hiii everyone Actually i am geting memberid from database as 1,2,123,124 but i want to amend the id as 00001,00002,00123 etc. Anyone can suggest me how i can get it. using array or any collection. Thanks in advance Gaurav Gupta
you can use split method then made a new id.
string _temp="1,12,123";
string[] arr=_temp.split(new char[]{','}); -
Hiii everyone Actually i am geting memberid from database as 1,2,123,124 but i want to amend the id as 00001,00002,00123 etc. Anyone can suggest me how i can get it. using array or any collection. Thanks in advance Gaurav Gupta
string formatted = 123.ToString("00000");
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L %^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2 W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN% R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
----------------------------------------------- 128 bit encrypted signature, crack if you can
-
you can use split method then made a new id.
string _temp="1,12,123";
string[] arr=_temp.split(new char[]{','});Hii Ali Thnaks for the response but actually i have id like 1.Now i want to make the id 0001 dynamically using for loop and array. e.g. if i have id 123 first read 3 then submit 3 in array which have 00000 now string have 12 read 2 and then submit in array noe 00023 i have now anly 1 remain get 1 and submit in array now id becomes 00123.Like that Thanks Gaurav
-
Hiii everyone Actually i am geting memberid from database as 1,2,123,124 but i want to amend the id as 00001,00002,00123 etc. Anyone can suggest me how i can get it. using array or any collection. Thanks in advance Gaurav Gupta
int id = 1;
string longID = string.Format("{0:00000}", id);this will result in "00001";
.45 ACP - because shooting twice is just silly
-----
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
-----
"The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001 -
Hiii everyone Actually i am geting memberid from database as 1,2,123,124 but i want to amend the id as 00001,00002,00123 etc. Anyone can suggest me how i can get it. using array or any collection. Thanks in advance Gaurav Gupta
Hi, When the data are integers, you store them as integers in the database, which will hold their value, and isn't interested in any formatting. When you show such numbers, make sure to apply the format you want. One way of getting that is:
int a=123;
Console.WriteLine("a="+a.ToString("D5"));:)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that.