1. ## ASP: CInt question

If I have a string and use CInt on it, it will drop all numeric characters, correct?

2. here you go sunny, this is some info u might find usefull http://share.intelidev.com/index.asp...item=vsfctcint curtesy of james

3. thanx for both answers (to the other question too, I may need to get you to email it as I closed the msn window *L*).

Anyways, that doesn't really seem to answer my question...

My question is... if I had:

a="a911a"
b=CInt(a)
response.write b

Would it return 911 or invalid? I could test it tomorrow on the server, but I'm at home now

4. doing
a="a911a"
b=CInt(a)
response.write b
will cos an error, but i think i get what u mean now, so i wrote a function for ya also added in a lil more at no extra cost

Code:
```function sortStr(str,strT)
strLen = len(str)
strCount = 1
Do Until strCount = strLen + 1
tLetter = left(str, 1)
If strT = 1 then
If isNumeric(tLetter) then
tStr = tStr + tLetter
end if
elseif strT = 2 then
If NOT isNumeric(tLetter) then
tStr = tStr + tLetter
end if
end if
str = right(str, strLen - strCount)
strCount = strCount + 1
Loop
sortStr = tStr
end function
response.write(sortStr("a1a2a3a4a5a6a7a8a9", 1) & "</p>" & sortStr("a1a2a3a4a5a6a7a8a9", 2))```
thats will return 123456789 and aaaaaaaaa. to parse out number, use sortStr(str, 1) and to parse letter use sortStr(str, 2)

i hope its what you looking for.

BTW the answer to the other question is in the actual post here in the forum

#### Posting Permissions

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