123 Eng

Engineering the engineers™


Latest Jobs   Forum Map

 


Home

Source Codes

Engineering Colleges

BE Students

Training  Reports (updated)

Seminar Reports (updated

Placement Papers (updated)

Forums

   Computer Science / IT

   Electronics

   Electrical

   Mechanical

   Chemical

   Civil

   CAT / MBA

   GMAT / Foreign MBA

Latest Jobs

Engineering Jobs / Technical Jobs

Management Jobs

Sitemap

About-Us

Terms of use

Displaying  Source Code(s)  
 

 
Breakup sentences longer than x Characters

--------------------------------------------------------------------------------



function mBreakupWordsLongerThanMax(byval vstrSentence, byval vlngMaxWordLength)
Dim lngIndex,strNextWord,strOutput
Dim arrWords

lngIndex=0
'get words into array
arrWords=split(vstrSentence," ")

'go through words
strOutput=""
'Response.Write "UBound(arrWords)" & UBo
'
' und(arrWords)
For lngIndex = 0 To UBound(arrWords)

strNextWord=arrWords(lngIndex)

'check if > max
if len(strNextWord > vlngMaxWordLength) Then
'> max
strOutput=strOutput & mSplitWord(strNextWord,vlngMaxWordLength)
Else
'<= max
strOutput=strOutput & strNextWord
End if

Next

'set return
if right(strOutput,1)=" " Then
'get rid of rightmost space
mBreakupWordsLongerThanMax=mid(strOutput,1,len(strOutput)-1)
Else
'return all
mBreakupWordsLongerThanMax=strOutput
End if

End function
function mSplitWord(byval vstrWord, _
byval vlngLength)
'*********************************
'purpose:split word
'inputs: vstrWord--word to split
' vlngLength--length to split at
'*********************************
Dim strOutput,lngIndex
strOutput=""
For lngIndex = 1 To len(vstrWord) step vlngLength

strOutput=strOutput & _
" " & mid(vstrWord,lngIndex,vlngLength)

Next

'set return
mSplitWord= mid(strOutput,2) & " "

End function

 

Contribute content or training reports / feedback / Comments
job placement papers
All rights reserved © copyright 123ENG