|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Replace problems
Well I am using the standard replace function in an aspx file, heres the code:
dim strpx as string dim strbegin,strend,endvalue,intCounter,oldvalue as integer strbegin = 5 oldvalue = 0 'for intCounter = 1 to 3 do oldvalue = oldvalue + 1 response.write (strbegin & " <b>" & oldvalue & "</b><br>") strbegin = inStr(strbegin,newimageurl,"top:") + 4 strend = inStr(strbegin,newimageurl,";") - strbegin response.write (strend & "<br>") response.write (instr(strbegin,mid(newimageURL,strbegin,strend),"px") & "<br>") if strbegin <> 4 then if len(mid(newimageURL,strbegin,strend)) > 3 then endvalue = (mid(newimageurl,strbegin,strend - 2) + 150) strpx = "px;" else endvalue = (mid(newimageurl,strbegin,strend) + 150) strpx = ";" end if response.write (endvalue & "<br>" & (strbegin - 4) & "<br><br>") newimageurl = replace(newimageurl,"top:" & mid(newimageurl,strbegin,strend) & ";","top:" & endvalue & strpx,(strbegin - 4),1) end if loop until strbegin < 5 the bit what is creating the problem is: newimageurl = replace(newimageurl,"top:" & mid(newimageurl,strbegin,strend) & ";","top:" & endvalue & strpx,(strbegin - 4),1) More specifically the start that I have set as a variable (strbegin - 4) if I leave this as 1 it goes through and works fine on most pages, but on a few pages the numbers are duplicated and it modifies the same one twice and other ones none at all. when I try to set the start to the variable so it starts in the right place it ends up replacing most of the areas I am searching and replacing. I have checked the variable and I am at a complete loss as to what is happening as it is definately the right number? The only thing I can think of is if it is because of the .aspx (.net) extension not liking variables for the start area of the replace function. Any help greatly appreciated. |
|
#2
|
|||
|
|||
|
never mind I figured out what was wrong, the start argument deletes everything in the string to the left of the character count
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > Replace problems |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|