How do I get Sharepoint username from display name programmatically? Is there any specific method?
While you should really keep in mind what Robert suggested in the above comment, if all you need is to try to resolve a name to a SharePoint user like the people picker does, you should have a look at the
SPUtility class methods
bool hasReachedTheMaxCount= false; List<SPPrincipalInfo> matchingUsers= SPUtility.SearchPrincipals(targetWeb, "search string", SPPrincipalType.User, SPPrincipalSource.All, null, 100, out reachedMaxCount);
Should return all principals (including users) with a name matching the given string.
Be wary that the documentation on these two methods is pretty bad, so you may need to do some experiments before finding the appropriate filters and flag masks to use to have only users returned.