Author |
Topic  |
|
Da_Stimulator
DEV Team Forum Moderator
    
USA
3373 Posts |
Posted - 10 November 2004 : 23:11:15
|
Updated! 11/11/04 - Updated to account for line breaks - Updated to account for other common punctuation (;, :)
Like a need it but http://www.demonstration.url!
In inc_func_common.asp find this code:
function ChkURLs(ByVal strToFormat, ByVal sPrefix, ByVal iType)
Dim strArray
Dim Counter
Directly after that code insert the following
if InStr(strToFormat, sPrefix)>0 then
Dim StrArray1
Dim LastChar, i
strToFormat = Replace(StrToFormat, "<br />", " :: ")
StrArray1 = split(strToFormat, " ")
if not(UBound(strArray1)<1) then
For i=0 to Ubound(strArray1)
if Left(strArray1(i), len(sPrefix))=sPrefix then
LastChar = Right(strArray1(i), 1)
'response.write(LastChar)
Select Case LastChar
Case ".",",","!","?",";",":"
strArray1(i) = Left(strArray1(i), len(strArray1(i))-1) & " " & LastChar
End Select
end if
i=i+1
Next
else
if Left(strArray1(0), len(sPrefix))=sPrefix then
LastChar = Right(strArray1(0), 1)
'response.write(LastChar)
Select Case LastChar
Case ".",",","!","?",";",":"
strArray1(0) = Left(strArray1(0), len(strArray1(0))-1) & " " & LastChar
End Select
end if
end if
strToFormat = Join(strArray1, " ")
strToFormat = Replace(strToFormat, " :: ", "<br />")
end if
Edit- Figured it could go in the bug forum< |
-Stim |
Edited by - Da_Stimulator on 11 November 2004 23:09:37 |
|
muzishun
Senior Member
   
United States
1079 Posts |
Posted - 11 November 2004 : 03:26:34
|
So if this is retarded, is it bad that I actually think this will come in handy? I've noticed this in the past, but just kind of dealt with it. This will be a nice bug fix. Well done.< |
Bill Parrott Senior Web Programmer, University of Kansas Co-Owner and Code Monkey, Eternal Second Designs (www.eternalsecond.com) Personal Website (www.chimericdream.com) |
Edited by - muzishun on 11 November 2004 03:26:54 |
 |
|
PeeWee.Inc
Senior Member
   
United Kingdom
1893 Posts |
Posted - 11 November 2004 : 04:00:11
|
Yeah, again, a small but good bug fix < |
De Priofundus Calmo Ad Te Damine |
 |
|
HuwR
Forum Admin
    
United Kingdom
20593 Posts |
Posted - 11 November 2004 : 04:44:25
|
I don't think it is retarded at all, it is correct to use a punctuation mark at the end of a sentance, it is writing work arounds for non existant words which I think is retarded < |
 |
|
MarcelG
Retired Support Moderator
    
Netherlands
2625 Posts |
|
Carefree
Advanced Member
    
Philippines
4216 Posts |
Posted - 11 November 2004 : 08:43:04
|
quote: Originally posted by Da_Stimulator
Case ".",",","!","?"
Need to add two more common ones
Case ".",",","!","?",";",":"
< |
 |
|
Da_Stimulator
DEV Team Forum Moderator
    
USA
3373 Posts |
Posted - 11 November 2004 : 10:36:06
|
quote: Originally posted by marcelgoertz
Da_Stimulator, could you tell me why it is not working, even after I've done this ? Look at http://www.oxle.nl/topic.asp?TOPIC_ID=1716 for instance. I've checked, and rechecked, and I've used the exact code you proposed...
Could you post your ChkURLs function for me?< |
-Stim |
 |
|
Da_Stimulator
DEV Team Forum Moderator
    
USA
3373 Posts |
Posted - 11 November 2004 : 11:52:12
|
Ok, thats because of line breaks, which I previously didnt account for...
Here's the fix. Right after this:
Dim LastChar, i
Insert code in green
Dim LastChar, i
strToFormat = Replace(StrToFormat, "<br />", " :: ")
StrArray1 = split(strToFormat, " ")
Then find this:
strToFormat = Join(strArray1, " ")
And insert code in green
strToFormat = Join(strArray1, " ")
strToFormat = Replace(strToFormat, " :: ", "<br />")
end if
Code at the top of the page has been updated
quote:
Need to add two more common ones
Case ".",",","!","?",";",":"
Added< |
-Stim |
Edited by - Da_Stimulator on 11 November 2004 14:31:25 |
 |
|
MarcelG
Retired Support Moderator
    
Netherlands
2625 Posts |
Posted - 12 November 2004 : 06:08:45
|
Well, it is working however, it is adding a space inbetween the url and the dot, comma, etc. I've fixed it now, by replacing the following code as shown in red. I 'tricked' it by using the bold tag...perhaps a better fix is available, but this did it for me.
if InStr(strToFormat, sPrefix)>0 then
Dim StrArray1
Dim LastChar, i
strToFormat = Replace(StrToFormat, "<br />", " :: ")
StrArray1 = split(strToFormat, " ")
if not(UBound(strArray1)<1) then
For i=0 to Ubound(strArray1)
if Left(strArray1(i), len(sPrefix))=sPrefix then
LastChar = Right(strArray1(i), 1)
'response.write(LastChar)
Select Case LastChar
Case ".",",","!","?",";",":"
strArray1(i) = Left(strArray1(i), len(strArray1(i))-1) & "<b></b>" & LastChar
End Select
end if
i=i+1
Next
else
if Left(strArray1(0), len(sPrefix))=sPrefix then
LastChar = Right(strArray1(0), 1)
'response.write(LastChar)
Select Case LastChar
Case ".",",","!","?",";",":"
strArray1(0) = Left(strArray1(0), len(strArray1(0))-1) & "<b></b>" & LastChar
End Select
end if
end if
strToFormat = Join(strArray1, " ")
strToFormat = Replace(strToFormat, " :: ", "<br />")
end if
Thanks for your help!< |
portfolio - linkshrinker - oxle - twitter |
 |
|
|
Topic  |
|
|
|