473,385 Members | 1,506 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Generating alpha numeric no

i need to Generate a unique id which contains 14 numeric and one Alphabatic which i need to increment it whenver i call the Function.

Eg: A00000000000001 to A99999999999999

and it should start from B00000000000001 to .......etc

Can anybody help me regarding this for generating it..

Thanks in advance....
May 11 '07 #1
6 2081
r035198x
13,262 8TB
i need to Generate a unique id which contains 14 numeric and one Alphabatic which i need to increment it whenver i call the Function.

Eg: A00000000000001 to A99999999999999

and it should start from B00000000000001 to .......etc

Can anybody help me regarding this for generating it..

Thanks in advance....
Go ahead and try it first, then we'll be glad to come in when you've written some code.
May 11 '07 #2
rsrinivasan
221 100+
Hi,

I write a program what u need. Try it..

public class ArrayCheck
{

public static void main(String[] args)
{
for(int i=1;i<=1000;i++)
{
String s = addZeros(String.valueOf(i));
String temp = "A"+s;
System.out.println(temp);
i=i++;
}
}
static String addZeros(String str)
{
int i=0;
i=str.length();

if ( i == 13 )
return str;
else
{
int j= 13 - i;

for (int k=0; k<j; k++)
{
str="0"+str;
}
return str;
}
}

}

Thanks,

Srinivasan r.
May 11 '07 #3
rsrinivasan
221 100+
Hello whether my code satisfies ur requirements or not. Plz reply me..

Thanks,

Srinivasan r
May 11 '07 #4
r035198x
13,262 8TB
Hi,

I write a program what u need. Try it..

public class ArrayCheck
{

public static void main(String[] args)
{
for(int i=1;i<=1000;i++)
{
String s = addZeros(String.valueOf(i));
String temp = "A"+s;
System.out.println(temp);
i=i++;
}
}
static String addZeros(String str)
{
int i=0;
i=str.length();

if ( i == 13 )
return str;
else
{
int j= 13 - i;

for (int k=0; k<j; k++)
{
str="0"+str;
}
return str;
}
}

}

Thanks,

Srinivasan r.
Use code tags when posting code. Also give others a chance to learn by themselves rather than have them do a copy paste all the time.
May 11 '07 #5
rsrinivasan
221 100+
Use code tags when posting code. Also give others a chance to learn by themselves rather than have them do a copy paste all the time.
Hi,

Ok. I forgot to put code tag.
May 12 '07 #6
hi Srinivas thanks for the code.., But i put my effort my side.., i Didnt check the code but as if now i will put two columns in a database one is for Alpabetic(ASCI value will be stored ) and other is for the 14 digit no.

so by means of the ASCI value i will increment it and append it at final stage..

Here Comes my code..,

public class UniqueId
{
public static void main(String ar[])
{
// Generating 15 unique no.
String Final;
String str="9999999999998";
int n=str.length();
if(n<14)
for(int i=0;i<14-n;i++)
{
str="0"+str;

}
if(str.equals("99999999999999"))
{
str="00000000000001";
//Here will be the Code to increment the value in the database for ASCI value
}
Final ="A"+str;
System.out.println(Final);
}
}

please correct me if i m Wrong..


Thanks,
May 12 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: entoone | last post by:
I have a field called pword, whenever someone enters anything but numeric, i.e. mixed alpha with numeric, or even just alpha.. the following error appears. Warning: mysql_numrows(): supplied...
3
by: success_ny | last post by:
Does anyone have a code snippet to compare those values so I can sort the array of alpha-numeric values that include both characters and integers in it? I.e., if we have values like 4236 and...
7
by: Peter | last post by:
Any one have a code snippet that would show me how to: 1. Generate a 24 character 2. Random 3. Alpha Numeric data dump 4. into an array IE.
5
by: Bosconian | last post by:
I need a comma delimited regular expression pattern with the followng restrictions: no leading and trailing white space no trailing comma double quoted numeric/alpha pairs each pair on a...
8
by: .Net Sports | last post by:
I am checking for text input on a form validation in javascript that required at least one numeric character along with any number of alpha characters for a given input text box. The below is a var...
1
by: shijith | last post by:
Hi, I am using MS-SQL 2000. I had a varchar column with data formated as Numeric portion + Alpha portion. Id ---- 1 2AA 2DF 2AB
5
lotus18
by: lotus18 | last post by:
Hello World! I have a sample code here written in vb .net that restricts the textbox to accept only alpha, alphanumeric or numeric characters. Public Enum MyOption Alpha = 1 ...
1
by: pranaysharmadelhi | last post by:
I want to generate a regular expression for password check.(ASP.Net) But javascript is what it really is. I would like to enforce Minimum 6 alphanumeric characters with minimum 1 numeric(0-9) and 1...
9
xaxis
by: xaxis | last post by:
Context: I'm working on a function that generates domain names. For instance, if I want to generate every possible domain name with 3 alpha characters, I've been doing something like this: ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.