Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 28th, 2009, 06:07 AM
Authorized User
 
Join Date: May 2007
Posts: 73
Thanks: 4
Thanked 0 Times in 0 Posts
Default string manipulation

Hi i am trying to write a function that gets the bumeric number out of a string but sonno how to o this.

E.g the string can be :

temp = "CID_19=Y"
temp = "CID_17=Y"
temp = "CID_199=Y"
temp = "CID_1219=Y"

What i have done so far is: (the problem i m facing is to get length the length which i hardcoded to 2 below.

ClientID = mid(temp,(InStr(temp,"_")+1),2)

so the ClientID should contain 19 or 17 or 199 or 1219


cheers
 
Old August 28th, 2009, 07:41 AM
Friend of Wrox
 
Join Date: May 2004
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
Default

If the pattern (CID_NUMBER=Y) is same then you can use something like:
Code:
temp = "CID_19=Y"
temp = "CID_17=Y"
temp = "CID_199=Y"
temp = "CID_1219=Y"
ClientID = replace(replace(temp,"CID_",""),"=Y","")
Response.Write ClientID
__________________
Om Prakash Pant
Click the "Thanks" button if this post helped you.





Similar Threads
Thread Thread Starter Forum Replies Last Post
String manipulation Franco1 Visual Basic 2005 Basics 1 July 16th, 2008 12:53 PM
String manipulation john316 SQL Language 1 October 1st, 2007 04:24 PM
String manipulation YoungLuke C# 4 May 4th, 2007 01:46 AM
String Manipulation twsinc Access 3 February 23rd, 2004 09:57 AM
String Manipulation Ben Access VBA 2 July 8th, 2003 05:53 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.