Thread: byRef/byVal
View Single Post
  #5 (permalink)  
Old Oct 9th, 2003, 13:17
jakyra jakyra is offline
Reputable Member
Join Date: Sep 2003
Location: USA
Posts: 112
Thanks: 0
Thanked 0 Times in 0 Posts
well, my code looks like this:
books(i, 5) = replace(getArrayData("isbn" & i), "-", "") 'isbnNoHyph
books(i, 0) = replace(getArrayData("isbn" & i), " " , "") 'isbn
books(i, 3) = isIsbn(books(i,5)) 'valid

(where getArrayData just finds a variable passed from the previous for that was loaded into an array)

initially I had
books(i, 0) = replace(getArrayData("isbn" & i), " " , "") 'isbn
books(i, 5) = replace(books(i,0), "-", "") 'isbnNoHyph

it also changes books(i,0) to not have any hyphens.

and also if I have this line
books(i, 3) = isIsbn(books(i,5)) 'valid
and I use books(i,0) instead of (i,5)
it also changes books(i,0) to not have any hyphens (isISBN removes the hyphens inside the function)

but, it's still passed as a parameter.

I've never encountered this before. My guess is that the arrays are getting passed byRef, that's the only thing I can think of.

for the record isISBN looks like this:


Code: Select all
<%
	Function IsIsbn(thisISBN)
	'upgrade to include 978 prefix
			'tests if value is legitimate thisISBN number
			Dim  intI , intSum , thisInt, HasFormat, thisISBN

			IsIsbn = False
			If Not IsNull(thisISBN) Then
				'Clean: Remove hypehens and spaces
				thisISBN = Replace(thisISBN, "-", "")
				thisISBN = Replace(thisISBN, " ", "")

				'Rule 1:     number must be exactly 10 units, the first 9 numbers, the last either a number or X
				HasFormat=False
				If len(thisISBN)=10 then
					if IsNumeric(Left(thisISBN, 9)) then
						if IsNumeric(Right(thisISBN,1)) or lcase(Right(thisISBN,1)) = "x" then
							HasFormat = True
						end if
					end if
				end if

 				If HasFormat then
 				'Rule 2:     All numbers, weighted by position, must sum to a number that is divisible by 11
					'Sum the digits by weight
					intI = 0
					Do While intI < 9
						intI = intI + 1
							thisInt = Mid(thisISBN, intI, 1)
							if IsNumeric(thisInt) then 	intSum = intSum + ((11 - intI) * cInt(thisInt))
					Loop
					'Add the check sum number
					intI = intI + 1

					If Ucase(Right(thisISBN, 1)) = "X" Then intSum = intSum + 10 Else intSum = intSum + cInt(Right(thisISBN,1))
					'and check for base 11 match
					IsIsbn = (intSum Mod 11 = 0)
				End If
			End If
	End Function

%>
Thanks
jakyra