Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 convering an asp function to SQL SERVER function

Author  Topic 

pelegk2
Aged Yak Warrior

723 Posts

Posted - 2006-02-20 : 02:58:16
i have this code which converts hebrew text problem and fix it
i have the code in asp
and i wonder whats the best way to convert it!
to translate it to a function in sql server or maybe other way?
this is the code :

function strInverse (str)
dim str1, str2, hebstr, engstr
engstr = false
hebstr = false
str1 = ""
str2 = ""
for i = 1 to len(str)
char = mid(str,i,1)
if asc(char)>=128 and asc(char)<159 then
hebstr = true
str1 = chr(asc(char) + 96) & str1
elseif asc(char)<128 then
engstr = true
str1 = char & str1
end if
next
if hebstr and engstr then
str1 = replace(str1,"(", "êêê")
str1 = replace(str1,")", "õõõ")
nn =instr(1, str1,"õõõ")
if nn > 2 then
nn=nn-2
if mid(str1,nn,1) = "." then str1 = left(str1,nn-1) & "óóó" & mid(str1,nn+1)
end if
for i = 1 to len(str1)
char = mid(str1,i,1)
if asc(char)<128 then
str2 = str2 & char
if i = len(str1) then
if len(trim(str2))>1 then
str_b = left(str1, i)
str_e = mid(str1, i+1)
str1 = replace(str_b,trim(str2), StrReverse(trim(str2))) & str_e
end if
str2 = ""
end if
else
if len(trim(str2))>1 then
str_b = left(str1, i)
str_e = mid(str1, i+1)
str1 = replace(str_b,trim(str2), StrReverse(trim(str2))) & str_e
end if
str2 = ""
end if
next

str1 = replace(str1, "êêê", ")")
str1 = replace(str1, "õõõ", "(")
str1 = replace(str1, "óóó", ".")
elseif not hebstr then
str1 = str
end if
strInverse = str1
end function





Israel -the best place to live in aftr heaven 9but no one wan't to go there so fast -:)
   

- Advertisement -