|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I want to make an ASP Function which should search like this
Suppose i have string like this String = " SELECT Colm1,Colm2,Colm3 FROM FV.VIEW_OF_MY_TABLE_NAME WHERE any condition" In this string i want to extract Only part after " FV. " and before space starts from right side of WHERE, " FV. " will static always in my string,But VIEW_OF_MY_TABLE_NAME is dynamic or could be differnt for next time. If any solution or script of asp then please help me. Thanks |
|
#2
|
|||
|
|||
|
Use string functions like InStr() and mid()
Use string functions like InStr() and mid():
(assuming you only ever have a single "." in a string this ought to work) Code:
mid(String,InStr(String,".")+1,InStr(InStr(String,"."),String," ")-InStr(String,".")-1) -sdpetersen Mohican Web Ware |
|
#3
|
||||
|
||||
|
here you go:
Code:
Function FindAdjacentWord(strText, strValue)
Dim nStartIndex, nSpaceIndex
FindAdjacentWord = ""
nStartIndex = InStr(LCase(strText), LCase(strValue))
If nStartIndex>0 Then
nSpaceIndex = InStr(nStartIndex + 1, strText, " ")
If nSpaceIndex=0 Then
nSpaceIndex = Len(strText)
End If
nStartIndex = nStartIndex + Len(strValue)
FindAdjacentWord = Mid(strText, nStartIndex, nSpaceIndex - nStartIndex)
End If
End Function
'usage:
strSQL = "SELECT Colm1,Colm2,Colm3 FROM FV.VIEW_OF_MY_TABLE_NAME WHERE any condition"
strViewName = FindAdjacentWord(strSQL, " FV.")
Response.Write("view name: " & strViewName)
|
|
#4
|
|||
|
|||
|
Thanks a lot Shadow Wizard....
its working as i want to do ,,,,Really thanks |
![]() |
| Viewing: ASP Free Forums > Programming > ASP Development > How to search a string? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|