Click here to Skip to main content
15,888,351 members
Home / Discussions / C#
   

C#

 
GeneralRe: my HTTP request handler code correct? Pin
George_George25-Apr-08 4:00
George_George25-Apr-08 4:00 
GeneralRe: my HTTP request handler code correct? Pin
Spacix One25-Apr-08 5:34
Spacix One25-Apr-08 5:34 
GeneralRe: my HTTP request handler code correct? Pin
George_George25-Apr-08 21:34
George_George25-Apr-08 21:34 
QuestionHow to Assign value to CodeMemberField object in CodeDom ? Pin
hdv21224-Apr-08 23:30
hdv21224-Apr-08 23:30 
Questionextracting domain name from email.. Pin
Adoremi24-Apr-08 23:13
Adoremi24-Apr-08 23:13 
GeneralRe: extracting domain name from email.. Pin
phannon8624-Apr-08 23:30
professionalphannon8624-Apr-08 23:30 
GeneralRe: extracting domain name from email.. Pin
Giorgi Dalakishvili24-Apr-08 23:37
mentorGiorgi Dalakishvili24-Apr-08 23:37 
AnswerRe: extracting domain name from email.. [modified] Pin
Spacix One25-Apr-08 2:57
Spacix One25-Apr-08 2:57 
Need this function:
private bool checkForSubDomain(string emailAddr)
{
    return (emailAddr.IndexOf('.', emailAddr.IndexOf('.'), 2) == emailAddr.LastIndexOf('.'));
}


Then you could do something like this if you need JUST the domain (without the TLD):
char [] findChar = (checkForSubDomain(emailAddr))?new char[] {'.'}:new char[] {'@'};
string emailDomain = emailAddr.Substring(emailAddr.IndexOf(findChar)+1, (emailAddr.Length - (emailAddr.IndexOf(findChar)+1)) - (emailAddr.Length - emailAddr.LastIndexOf('.')));


This is quick and sloppy but, I'm sure you could make it better Smile | :)


[EDITS]
Never mind this crap it wouldn't work with .co.uk and ect..


-Spacix
All your skynet questions[^] belong to solved

modified on Friday, April 25, 2008 9:36 AM

GeneralRe: extracting domain name from email.. Pin
Mike Dimmick25-Apr-08 3:24
Mike Dimmick25-Apr-08 3:24 
GeneralRe: extracting domain name from email.. Pin
Spacix One25-Apr-08 3:36
Spacix One25-Apr-08 3:36 
GeneralRe: extracting domain name from email.. Pin
Adoremi26-Apr-08 7:06
Adoremi26-Apr-08 7:06 
QuestionHow do I force the printer to print in grayscale mode from C#? Pin
Faysal24-Apr-08 22:05
Faysal24-Apr-08 22:05 
AnswerRe: How do I force the printer to print in grayscale mode from C#? Pin
Mircea Puiu25-Apr-08 1:31
Mircea Puiu25-Apr-08 1:31 
Generalcreate a new file with exclusive owner mode Pin
George_George24-Apr-08 21:18
George_George24-Apr-08 21:18 
GeneralRe: create a new file with exclusive owner mode Pin
Ed.Poore24-Apr-08 21:19
Ed.Poore24-Apr-08 21:19 
GeneralRe: create a new file with exclusive owner mode Pin
George_George24-Apr-08 21:30
George_George24-Apr-08 21:30 
GeneralRe: create a new file with exclusive owner mode Pin
Vasudevan Deepak Kumar24-Apr-08 21:22
Vasudevan Deepak Kumar24-Apr-08 21:22 
GeneralRe: create a new file with exclusive owner mode Pin
George_George24-Apr-08 21:30
George_George24-Apr-08 21:30 
GeneralRe: create a new file with exclusive owner mode Pin
Vasudevan Deepak Kumar25-Apr-08 2:18
Vasudevan Deepak Kumar25-Apr-08 2:18 
GeneralRe: create a new file with exclusive owner mode Pin
George_George25-Apr-08 2:46
George_George25-Apr-08 2:46 
GeneraldateTimePicker in Datagrid Pin
Denver Thomas24-Apr-08 20:45
Denver Thomas24-Apr-08 20:45 
GeneralRe: dateTimePicker in Datagrid Pin
Mircea Puiu25-Apr-08 1:21
Mircea Puiu25-Apr-08 1:21 
GeneralSample code for using omni scanner in C# Pin
Rashmi_Karnam24-Apr-08 20:42
Rashmi_Karnam24-Apr-08 20:42 
GeneralRe: Sample code for using omni scanner in C# Pin
Vasudevan Deepak Kumar24-Apr-08 21:19
Vasudevan Deepak Kumar24-Apr-08 21:19 
GeneralWeb service function name to display spaces in framework 2.0 Pin
SB 24-Apr-08 19:44
SB 24-Apr-08 19:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.