Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is there a STRTRAN function which is not case sensitive
Message
 
 
To
29/04/2002 18:52:11
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00650635
Message ID:
00650683
Views:
42
>Mark.
>
>You are right!!! A thousand excuses. The problem of not bringing the neurons to the work.
>
>Bye!
>
>Pablo
********************************************************************
*  Description.......: non case-sensitive string translation
*  Calling Samples...:
*  Parameter List....:
*  Created by........: Steven Black
*  Modified by.......: Nadya Nosonovsky 05/09/2001 03:54:52 PM
********************************************************************
function STRTRANC
lparameters Expc1, Expc2, Expc3, Expn1, Expn2
local lcExpr, lnat_pos, lnat_pos2, lnI, lnJ
if vartype(m.Expc1)<>"C" or vartype(m.Expc2)<>"C" or vartype(m.Expc3)<>"C"
	return ""
endif
if empty(m.Expc1) or empty(m.Expc2)
	return m.Expc1
endif
lcExpr=m.Expc1
if vartype(m.Expn1)#'N'
	Expn1=1
endif
if vartype(m.Expn2)#'N'
	Expn2=len(m.Expc1)
endif
if m.Expn1<1 or m.Expn2<1
	return m.Expc1
endif
m.lnI=0
m.lnJ=0
m.lnat_pos2=1
do while .t.
	lnat_pos=atc(m.Expc2,substr(m.lcExpr,m.lnat_pos2))
	if m.lnat_pos=0
		exit
	endif
	lnI=m.lnI+1
	if m.lnI<m.Expn1
		lnat_pos2=m.lnat_pos+m.lnat_pos2+len(m.Expc2)-1
		loop
	endif
	lcExpr=left(m.lcExpr,m.lnat_pos+m.lnat_pos2-2)+m.Expc3+ ;
		substr(m.lcExpr,m.lnat_pos+m.lnat_pos2+len(m.Expc2)-1)
	lnJ=m.lnJ+1
	if m.lnJ>=m.Expn2
		exit
	endif
	lnat_pos2=m.lnat_pos+m.lnat_pos2+len(m.Expc3)-1
	if m.lnat_pos2>len(m.lcExpr)
		exit
	endif
enddo
return m.lcExpr
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform