ASP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingASP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old November 6th, 2009, 10:43 AM
Shirani Shirani is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2009
Posts: 2 Shirani User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 40 m 45 sec
Reputation Power: 0
Post How to search a string?

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

Reply With Quote
  #2  
Old November 6th, 2009, 04:55 PM
sdpetersen sdpetersen is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2009
Location: Utah
Posts: 1 sdpetersen User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 23 sec
Reputation Power: 0
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

Reply With Quote
  #3  
Old November 6th, 2009, 05:24 PM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
ASP Free God 48th Plane (28500 - 28999 posts)
 
Join Date: Sep 2004
Location: Israel
Posts: 28,838 Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)  Folding Points: 549372 Folding Title: Super Ultimate Folder - Level 2Folding Points: 549372 Folding Title: Super Ultimate Folder - Level 2Folding Points: 549372 Folding Title: Super Ultimate Folder - Level 2Folding Points: 549372 Folding Title: Super Ultimate Folder - Level 2Folding Points: 549372 Folding Title: Super Ultimate Folder - Level 2Folding Points: 549372 Folding Title: Super Ultimate Folder - Level 2Folding Points: 549372 Folding Title: Super Ultimate Folder - Level 2
Time spent in forums: 3 Months 2 Weeks 1 Day 14 h 30 m 10 sec
Reputation Power: 2389
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)

Reply With Quote
  #4  
Old November 7th, 2009, 11:08 AM
Shirani Shirani is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2009
Posts: 2 Shirani User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 40 m 45 sec
Reputation Power: 0
Thanks a lot Shadow Wizard....
its working as i want to do ,,,,Really thanks

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingASP Development > How to search a string?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump





 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 1 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek