Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# .NET4.5
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 5: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 at 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 at 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 at 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
0 OriginalGriff 350
1 Jochen Arndt 190
2 Richard MacCutchan 135
3 Sergey Alexandrovich Kryukov 130
4 DamithSL 95
0 OriginalGriff 6,045
1 DamithSL 4,601
2 Maciej Los 4,087
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,310


Advertise | Privacy | Mobile
Web02 | 2.8.141220.1 | Last Updated 10 Dec 2012
Copyright © CodeProject, 1999-2014
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