want to get number on right hand side of "=" sign

# Thread: want to get number on right hand side of "=" sign

1. Senior Member
Join Date
Dec 1969
Posts
702

## want to get number on right hand side of "=" sign

I get a field ("Field1") from a query with a result that looks like this "SPAMcount=24"<BR><BR>I just want to display the number 24 so I do this:<BR> spams = right(rsmail("Field1"),2)<BR><BR>This works except that the number keeps growing to 3 and 4 digits - how can I ensure that I always get the full number to the right of the "=" sign?<BR><BR>Thanks for any help

2. Senior Member
Join Date
Dec 1969
Posts
96,118

...find the link to "VBScript Reference", click on it.<BR><BR>In the list of topics that appears, click on "Functions"<BR><BR>In the list of functions that appears, investigate INSTR, INSTRREV, SPLIT.<BR><BR>I&#039;d probably to this:<BR><BR>&#060;%<BR>temp = rsMail("field1")<BR>spams = CLNG( Trim( Mid( temp, InStrRev( temp, "=" ) + 1 ) ) )<BR>%&#062;<BR><BR>Which converts the string to a number at the same time, if you care.<BR><BR>But you could use two or 3 other methods successfully.<BR>

3. Senior Member
Join Date
Dec 1969
Posts
11,247

## RE: want to get number on right hand side of

spamsarray = split(rsmail("Field1"),"=")<BR>spams = spamsarray[1]

4. Senior Member
Join Date
Dec 1969
Posts
702

## Thanks - 2 interesting, unique suggestions <e

.

5. Senior Member
Join Date
Dec 1969
Posts
96,118

## What's with the [ ] in VBS???

AND...if you are paranoid like I am:<BR><BR>&#060;%<BR>spamsarray = split(rsmail("Field1"),"=")<BR>spams = spamsarray( UBound(spamsarray) ) &#039; in case there are multiple "="<BR>%&#062;<BR><BR>And you could also do this with a regular expression:<BR><BR>&#060;%<BR>Set re = New RegExp<BR>re.Pattern = "[^d]"<BR>re.Global = True<BR>spams = CLNG( re.Replace( rsmail("Field1"), "" ) )<BR>%&#062;<BR><BR>But of course that&#039;s just being silly, since the other two methods are easier.<BR><BR>

6. Senior Member
Join Date
Dec 1969
Posts
11,247

## LOL

Been doing Perl all day! hmmm

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•