datatek Posted October 28, 2008 Share Posted October 28, 2008 $voller_name = ($vorname & " " & $nachname) $Name_conv = StringLower(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace(StringReplace($voller_name,"ü","ue"),"ö","oe"),"ä","ae"),"ß","ss"),"Ü","Ue"),"Ö","Oe"),"Ä","Ae")) If StringInStr($Name_split[$Name_split[0]], '-') Then $var = StringSplit($Name_split[$Name_split[0]], '-') $Name_split[$Name_split[0]] = $var[$var[0]] EndIf $bname = StringLeft($Name_split[1], 1) & "." & $Name_split[$Name_split[0]] In the above code first name and surname are split and, if there is a hypen in the name, the second part selected for $bname. I need to have the first part before the hypen, instead of the second. Could someone help? Link to comment Share on other sites More sharing options...
dbzfanatic Posted October 28, 2008 Share Posted October 28, 2008 Would you mind giving an example output? Your code seems a bit...messy. What exactly are you trying to do by the way? There may be an easier way to do it. Go to my website. | My Zazzle Page (custom products)Al Bhed Translator | Direct linkScreenRec ProSimple Text Editor (STE) [TUTORIAL]Task Scheduler UDF <--- First ever UDF!_ControlPaste() UDF[quote name='renanzin' post='584064' date='Sep 26 2008, 07:00 AM']whats help ?[/quote] Link to comment Share on other sites More sharing options...
datatek Posted October 28, 2008 Author Share Posted October 28, 2008 Would you mind giving an example output? Your code seems a bit...messy. What exactly are you trying to do by the way? There may be an easier way to do it. If I put in the name "Sam Adams", the output is s.adams (this is also what I want). If I put in the name "John Smith-Weston", the output is j.weston, but I want j.smith (the part before the -, not the part after it). The relevant part of the code is If StringInStr($Name_split[$Name_split[0]], '-') Then $var = StringSplit($Name_split[$Name_split[0]], '-') $Name_split[$Name_split[0]] = $var[$var[0]] EndIf Link to comment Share on other sites More sharing options...
dbzfanatic Posted October 28, 2008 Share Posted October 28, 2008 Full working code. Short,simple, to the point $name = InputBox("Name","Enter your name","") If StringInStr($name,"-") Then $split = StringSplit($name,"-") $newname = StringSplit($split[1]," ") $out = StringLeft($newname[1],1) & "." & $newname[2] EndIf MsgBox(0,"",$out) Go to my website. | My Zazzle Page (custom products)Al Bhed Translator | Direct linkScreenRec ProSimple Text Editor (STE) [TUTORIAL]Task Scheduler UDF <--- First ever UDF!_ControlPaste() UDF[quote name='renanzin' post='584064' date='Sep 26 2008, 07:00 AM']whats help ?[/quote] Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now