Need Help....don't wnat a space ?
-
if i say Enter your full name :Peter Alian Smith So this name has to be start from char no space from starting name. once user write his first name only one space allow not more then one space. again user write his middle name and only one space allow not more then one space... So is that anyone can help me.what should i use ? -Thanks
Peter
-
if i say Enter your full name :Peter Alian Smith So this name has to be start from char no space from starting name. once user write his first name only one space allow not more then one space. again user write his middle name and only one space allow not more then one space... So is that anyone can help me.what should i use ? -Thanks
Peter
Why do you need it to be so strict ? The Trim method removes leading and trailing spaces. A regex or a split and then rejoining with only one space would fix the rest.
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
Why do you need it to be so strict ? The Trim method removes leading and trailing spaces. A regex or a split and then rejoining with only one space would fix the rest.
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
You mean, you tried Christian's suggestion and it didn't work?
-- gleat http://blogorama.nerdworks.in[^] --
Once we figured out that taking our shoes and socks off would double our counting ability the technical glitch was quickly rectified.
-- Chris Maunder, from the CP newsletter
-
Why ? Are you thnking I am trying to keep the good methods a secret ? A regex is your best bet. Splitting and rejoining the string is more code, and messier, but perhaps easier to understand. If you don't want either of those methods, I recommend prayer.
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
Why ? Are you thnking I am trying to keep the good methods a secret ? A regex is your best bet. Splitting and rejoining the string is more code, and messier, but perhaps easier to understand. If you don't want either of those methods, I recommend prayer.
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
Christian Graus wrote:
keep the good methods a secret
Yeah, let's not tell him about
name = name.Trim().Replace ( "\t" , " " ).Replace ( " " , " " ) ;
as it's far too advanced. :-D