Ver Mensaje Individual
  #4 (permalink)  
Antiguo 19/02/2003, 13:14
Avatar de mrgubu
mrgubu
 
Fecha de Ingreso: febrero-2002
Ubicación: Granada
Mensajes: 431
Antigüedad: 23 años, 2 meses
Puntos: 2
En ASP sería así, tomado de WebWizGuide.com:

Código:
  'Initialse variables
blnWordLenthOK = True
blnNewURL = False

'Read in user deatils from the add URL form

strInputDescription = Request.Form("description")

'Where someones has pressed return in there description replace this with a space 
'as otherwise the last word and first word on the line are seen as one word and may go over the 30 chraracter limit
strInputDescription = Replace(strInputDescription, vbCrLf, " ")


'Split-up each word in the description from the user to check that no word entered is over 30 characters
saryDescriptionWord = Split(Trim(strInputDescription), " ")
	

'Loop round to check that each word in the description entered by the user is not above the 30 characters
For intCheckWordLengthLoopCounter = 0 To UBound(saryDescriptionWord)
	
	'Initialise the intWordLength variable with the length of the word to be searched
	intWordLength = Len(saryDescriptionWord(intCheckWordLengthLoopCounter))
	
	'Get the number of characters in the longest word
	If intWordLength => intLongestWordLength Then 
		intLongestWordLength = intWordLength
	End If
		
	'If the word length to be searched is more than or equal to 30 then set the blnWordLegthOK to false
	If intWordLength => 30 Then 
		blnWordLenthOK = False
				
	End If
Next


'If the user has entered no words over 30 characters then write to database 
If blnWordLenthOK = True Then

'Aquí creas el recordset de escritura en la base de datos, desarrollas la SQL, etc... 

End If
Espero que te sirva.