vb.net - Extract middle name -


i need find out how extract middle name full name displayed in output text box, far can middle name , half last name displayed. main issue having dont know how indexof second space seperates middle , last name. code far:

private sub btnclick_click(byval sender system.object, byval e system.eventargs) handles btnclick.click     dim fullname, firstname, middlename, lastname string     dim n, m integer      fullname = txtfullname.text     n = fullname.indexof(" ")     m = fullname.lastindexof(" ")     firstname = fullname.substring(0, n)     lastname = fullname.substring(m + 1)     middlename = fullname.substring(n, m)     txtmiddlename.text = middlename  end su 

once you've found first space, split string 2 strings, 1 before first space , 1 after it. can split second string @ first space extract middle name.

i should point out, however, nonsense because makes bogus assumptions how humans named. there first names spaces in them. "mary lou" , "john henry" can both first names.

there person named "yuv raj vig". think first name is? it's not "yuv". "raj", because "yuv" can title, it's not either.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -