Click here to Skip to main content
12,951,497 members (49,010 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
HI am a new learner of C#.. I wanna do some project. in my project io have to generate email id optiions for the user from the first and last name i got from the user... ie: "Firstlast@x.com, lastfirst@x.com, firstfirst@x.com"... Please suggest some methods for me...
Posted 10-Dec-12 4:27am
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

To get email id that does not exist, you should have all the already existing ids in a database.

Then you look for the different combination firstlast, lastfirst, firstfirst, ...
And each time you find a matching id in your database, you create a counter a try one more time with this counter value (ex. firstlast1, then firstlast2, ...)

Or do avoid a lot of requests to the database, if you know SQL syntax, you can do a search like:
SELECT knownid FROM KnownIDTable WHERE knownid LIKE 'firstlast%'

and then analyze the rows to get the unique value for your counter.
  Permalink  
Comments
Sergey Alexandrovich Kryukov 10-Dec-12 18:06pm
   
5.
--SA
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

you can concatenate first name and last name. but that will not always generate an unique mail id.

my suggestion is if you are building an application with a login , the login name should be unique value. you can get a combination of login name + first name+ last name
  Permalink  
Comments
Pascal-78 10-Dec-12 10:51am
   
Adding text to an unique id does not keep it unique.
A + BC + D = AB + C + D = ABCD
A & AB are different strings but with added characters the result strings are identical.
Sergey Alexandrovich Kryukov 10-Dec-12 18:05pm
   
Good point. Another 5. :-)
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 6,084
CHill60 3,480
Maciej Los 3,083
Jochen Arndt 1,975
ppolymorphe 1,830


Advertise | Privacy | Mobile
Web02 | 2.8.170525.1 | Last Updated 10 Dec 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100