Friday, September 14, 2012

Reverses the order of words (not characters) in a sentence -“Good Morning Everybody” to “Everybody Morning Good”


' Write a program that reverses the order of words (not characters) in a sentence.
'For example, the program should change the sentence “Good Morning Everybody” to “Everybody Morning Good”

StrPR2 = InputBox("String to be Reversed")
SplitStr= Split(StrPR2)
For i = UBound(SplitStr) to 0 Step -1
StrRev=StrRev+" "+SplitStr(i)
Next
MsgBox StrRev

No comments:

Post a Comment