Click here to Skip to main content
15,891,253 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi All,

i want to create domain name dynamically(like user1.example.com)and want to get first word i.e,user1 to fetch data from database.please reply with an example.
Posted

OK. This appears to be very simple string manipulation. Look at String.SubString and String.IndexOf. You get the position of the first period in the domain name then use that to grab the first x number of characters of the string to get the name.
 
Share this answer
 
A variation ofmDaves answer: Ese String.Split(".") to break the string up into separate parts and the use String.Substring(0,1) to get the first character of the first element in the resulting array.
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900