p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

proasp_codeclinic thread: vb script syntax


Message #1 by m.murray@s... on Thu, 29 Nov 2001 12:09:39
Hi,

    Try this. strText is a variable for Input box text

If InStr(strText, "and") = 0 And InStr(strText, "or")
= 0 Then
    strText = Replace(strText, " ", "And")
End If

But see to that there is only single space between two
words
else try the below and then use the above logic

While InStr(strText, "  ") > 0 
    strText = Replace(strText, "  ", " ")
Wend

Rgds,
Bala


--- m.murray@s... wrote:
> can anyone help me writing this script?
> 
> i need to manipulate a text string from an input box
> 
> 1) if it is a single word  "pineapple" leave it
> alone
> 
> 2) if it is 2 words "pineapple juice" change it to
> "pineapple and juice"
> 
> 3) if the string already contains "and" or "or" 
> eg. "pineapple and juice"  or "pineapple or juice" 
> leave it as is
> 
> 4) if it contains the word "not"  
> eg. "pineapple not juice" 
> change it to "pineapple and not juice"
> 
> 5) if the text string is "pineapple and not juice" 
> leave it as is
> 
> phew! any help muchly appreciated!
> 
> cheers!
> 
> Matt
> 
> ---
> You are currently subscribed to proasp_codeclinic
> as: rbchandar@y...
> $subst('Email.Unsub')
> 
> Read the future with ebooks at B&N
>
http://service.bfast.com/bfast/click?bfmid=2181&sourceid=38934667&categoryid=rn_ebooks


__________________________________________________
Do You Yahoo!?
Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
http://geocities.yahoo.com/ps/info1

  Return to Index