ASP – Numero di file presenti in una directory

<% Set fso = CreateObject(“Scripting.FileSystemObject”) Set folderObject = fso.GetFolder(Server.MapPath(“dbstage”)) Set filesObject = folderObject.Files i=0 For Each file In filesObject i=i+1 Next response.write “Numero file: “& i & ” files uploadati!” Set fileObject = Nothing Set folderObject = Nothing Set fso = Nothing %>

ASP – Troncare una stringa senza troncare le parole

<% Function limitaCaratteri(frase, lunghMax) dimMax = LEN(frase) if dimMax > lunghMax then estrattoBreve = “” ultimoCarattere = “a” contatore = lunghMax while ultimoCarattere <> ” “ estrattoBreve = LEFT(frase,contatore) ultimoCarattere = RIGHT(estrattoBreve,1) contatore = contatore – 1 if contatore = 0 then ultimoCarattere = ” “ end if wend if contatore <> 0 then estrattoBreve = LEFT(frase,contatore) & “…” else … Continua a leggere

LS – Togliere gli spazi a destra e sinistra di una

<SCRIPT> function LeTrim() { //Tolgo spazi da inizio stringa re=/^s+/g; with (document.modulo) { output.value=input.value.replace(re,””); } } function RiTrim() { //Tolgo spazi da fine stringa re=/s+$/g; with (document.modulo) { output.value=input.value.replace(re,””); } } </SCRIPT> <INPUT TYPE=”button” VALUE=”Left Trim” onClick=”LTrim()”> –