Fonctions

Scinder des chaines de caratères

'Function used to split a string on two or more lines if its length is greater than the specified max length
' str        : the string to be splited
' maxlenght  : the maxlenght each line of string should be
' forcessplit : tells if a string can be splited anywhere, meaning it can split a word
' useHtml     : use the HTML way of line break (<br/>) instead of vb way (vbCrLf)
function splitStr(str, maxlength, forcesplit, useHtml)
  if useHtml then
    replacewith = "<br/>"
  else
    replacewith = vbCrLf
  end if
    pos = maxlength
    do while pos < len(str)
    if forcesplit then
      str = mid(str, pos-maxlength,maxlength) & replacewith & mid(str,pos)	'Mid(string,start[,length]) 
    else
      start = instrrev(str, vbSpace, pos)  'InStrRev(string1,string2[,start[,compare]]) 
      call Replace(str,vbSpace,replacewith,start,1,1) 'Replace(string,find,replacewith[,start[,count[,compare]]]) 		
    end if
    pos = pos + maxlength
  loop 
  splitStr = str
end function

Voir s'il existe des enregistrements dans un recordset

RecordExist = not (rs.BOF And rs.EOF)
'Response.Write("record exist ? = " & RecordExist)

Ressources

 
prog/basic/vbscript.txt · Dernière modification: 2011/06/03 12:08 (modification externe)
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki