Hy
I need to replace a string in a large text BUT even occurrences are upper or
lower case
e.g. Museo Archeologico, Museo archeologico, museo archeologico with "Museo
Archeologico"


I can I do?

Thanks

Re: replace a string by McKirahan

McKirahan
Mon Sep 13 06:07:07 CDT 2004

"WebRaster" <web-master-@-wstaff.it> wrote in message
news:ci3j59$gdp$1@newsread.albacom.net...
> Hy
> I need to replace a string in a large text BUT even occurrences are upper
or
> lower case
> e.g. Museo Archeologico, Museo archeologico, museo archeologico with
"Museo
> Archeologico"
>
>
> I can I do?
>
> Thanks

Use LCase() to convert the string to lower case before using InStr() or
Replace().



R: replace a string by WebRaster

WebRaster
Mon Sep 13 09:42:03 CDT 2004

Excuse my question wasn't clear
I use a a variables passed by URL, a querystring e.g. "National Museum", I
wish replace in the page all the occurences of "National Museum", "National
museum", "national Museum", and so on with "<b>National Museum</b>"
I don't want to convert all text in lower case.
Perhaps more clear
Thank You

McKirahan <News@McKirahan.com> wrote in message
vbf1d.168694$9d6.88942@attbi_s54...
> "WebRaster" <web-master-@-wstaff.it> wrote in message
> news:ci3j59$gdp$1@newsread.albacom.net...
> > Hy
> > I need to replace a string in a large text BUT even occurrences are
upper
> or
> > lower case
> > e.g. Museo Archeologico, Museo archeologico, museo archeologico with
> "Museo
> > Archeologico"
> >
> >
> > I can I do?
> >
> > Thanks
>
> Use LCase() to convert the string to lower case before using InStr() or
> Replace().
>
>



Re: replace a string by McKirahan

McKirahan
Mon Sep 13 10:33:05 CDT 2004

"WebRaster" <web-master-@-wstaff.it> wrote in message
news:ci4bcf$5q4$1@newsread.albacom.net...
> Excuse my question wasn't clear
> I use a a variables passed by URL, a querystring e.g. "National Museum", I
> wish replace in the page all the occurences of "National Museum",
"National
> museum", "national Museum", and so on with "<b>National Museum</b>"
> I don't want to convert all text in lower case.
> Perhaps more clear
> Thank You
>
> McKirahan <News@McKirahan.com> wrote in message
> vbf1d.168694$9d6.88942@attbi_s54...
> > "WebRaster" <web-master-@-wstaff.it> wrote in message
> > news:ci3j59$gdp$1@newsread.albacom.net...
> > > Hy
> > > I need to replace a string in a large text BUT even occurrences are
> upper
> > or
> > > lower case
> > > e.g. Museo Archeologico, Museo archeologico, museo archeologico with
> > "Museo
> > > Archeologico"
> > >
> > >
> > > I can I do?
> > >
> > > Thanks
> >
> > Use LCase() to convert the string to lower case before using InStr() or
> > Replace().
> >

Try the following; watch for word-wrap.

Option Explicit
'*
Const cVBS = "museum.vbs"
'*
Dim intPOS
intPOS = 1
Dim arrTXT(2)
arrTXT(0) = "National Museum"
arrTXT(1) = "The 'national Museum' is the same as 'National
museum'."
arrTXT(2) = arrTXT(1)
Dim intTXT
Dim strTXT
'*
Do
intTXT = InStr(intPOS,LCase(arrTXT(1)),LCase(arrTXT(0)))
If intTXT = 0 Then Exit Do
strTXT = Mid(arrTXT(2),intTXT,Len(arrTXT(0)))
arrTXT(2) = Replace(arrTXT(2),strTXT,arrTXT(0))
intPOS = intTXT + Len(arrTXT(0))
Loop
'*
MsgBox arrTXT(0) & vbCrLf & arrTXT(1) & vbCrLf &
arrTXT(2),vbInformation,cVBS

This doesn't (yet) handle adding tags (i.e. <b></b>) but it does fix the
capitalizations.



Re: replace a string by McKirahan

McKirahan
Mon Sep 13 10:40:15 CDT 2004

"McKirahan" <News@McKirahan.com> wrote in message
news:R4j1d.41133$D%.26889@attbi_s51...
> "WebRaster" <web-master-@-wstaff.it> wrote in message
> news:ci4bcf$5q4$1@newsread.albacom.net...
> > Excuse my question wasn't clear
> > I use a a variables passed by URL, a querystring e.g. "National Museum",
I
> > wish replace in the page all the occurences of "National Museum",
> "National
> > museum", "national Museum", and so on with "<b>National Museum</b>"
> > I don't want to convert all text in lower case.
> > Perhaps more clear
> > Thank You

[snip]

This version handles tags' watch for word-wrap.

Option Explicit
'*
Const cVBS = "museums.vbs"
'*
Dim intPOS
intPOS = 1
Dim arrTXT(3)
arrTXT(0) = "National Museum"
arrTXT(1) = "<b>National Museum</b>"
arrTXT(2) = "The 'national Museum' is the same as 'National
museum'."
arrTXT(3) = arrTXT(2)
Dim intTXT
Dim strTXT
'*
Do
intTXT = InStr(intPOS,LCase(arrTXT(3)),LCase(arrTXT(0)))
If intTXT = 0 Then Exit Do
strTXT = Mid(arrTXT(3),intTXT,Len(arrTXT(0)))
arrTXT(3) = Replace(arrTXT(3),strTXT,arrTXT(1))
intPOS = intTXT + Len(arrTXT(1))
Loop
'*
MsgBox arrTXT(0) & vbCrLf & arrTXT(1) & vbCrLf & arrTXT(2) & vbCrLf &
arrTXT(3),vbInformation,cVBS



R: replace a string by WebRaster

WebRaster
Tue Sep 14 04:08:34 CDT 2004

Thank you very much, your help works.
Bye

McKirahan <News@McKirahan.com> wrote in message
zbj1d.169410$9d6.70554@attbi_s54...
> "McKirahan" <News@McKirahan.com> wrote in message
> news:R4j1d.41133$D%.26889@attbi_s51...
> > "WebRaster" <web-master-@-wstaff.it> wrote in message
> > news:ci4bcf$5q4$1@newsread.albacom.net...
> > > Excuse my question wasn't clear
> > > I use a a variables passed by URL, a querystring e.g. "National
Museum",
> I
> > > wish replace in the page all the occurences of "National Museum",
> > "National
> > > museum", "national Museum", and so on with "<b>National Museum</b>"
> > > I don't want to convert all text in lower case.
> > > Perhaps more clear
> > > Thank You
>
> [snip]
>
> This version handles tags' watch for word-wrap.
>
> Option Explicit
> '*
> Const cVBS = "museums.vbs"
> '*
> Dim intPOS
> intPOS = 1
> Dim arrTXT(3)
> arrTXT(0) = "National Museum"
> arrTXT(1) = "<b>National Museum</b>"
> arrTXT(2) = "The 'national Museum' is the same as 'National
> museum'."
> arrTXT(3) = arrTXT(2)
> Dim intTXT
> Dim strTXT
> '*
> Do
> intTXT = InStr(intPOS,LCase(arrTXT(3)),LCase(arrTXT(0)))
> If intTXT = 0 Then Exit Do
> strTXT = Mid(arrTXT(3),intTXT,Len(arrTXT(0)))
> arrTXT(3) = Replace(arrTXT(3),strTXT,arrTXT(1))
> intPOS = intTXT + Len(arrTXT(1))
> Loop
> '*
> MsgBox arrTXT(0) & vbCrLf & arrTXT(1) & vbCrLf & arrTXT(2) & vbCrLf &
> arrTXT(3),vbInformation,cVBS
>
>