Consolidated ASP Classic MVC framework from best components
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

74 lignes
2.1KB

  1. <%
  2. '=======================================================================================================================
  3. ' StringBuilder Class
  4. '=======================================================================================================================
  5. Class StringBuilder_Class
  6. dim m_array
  7. dim m_array_size
  8. dim m_cur_pos
  9. Private Sub Class_Initialize
  10. m_array = Array
  11. m_array_size = 100
  12. redim m_array(m_array_size)
  13. m_cur_pos = -1
  14. End Sub
  15. Private Sub Extend
  16. m_array_size = m_array_size + 100
  17. redim preserve m_array(m_array_size)
  18. End Sub
  19. Public Sub Add(s)
  20. m_cur_pos = m_cur_pos + 1
  21. m_array(m_cur_pos) = s
  22. if m_cur_pos = m_array_size then Extend
  23. End Sub
  24. Public Function [Get](delim)
  25. 'have to create a new array containing only the slots actually used, otherwise Join() happily adds delim
  26. 'for *every* slot even the unused ones...
  27. dim new_array : new_array = Array()
  28. redim new_array(m_cur_pos)
  29. dim i
  30. for i = 0 to m_cur_pos
  31. new_array(i) = m_array(i)
  32. next
  33. [Get] = Join(new_array, delim)
  34. End Function
  35. Public Default Property Get TO_String
  36. TO_String = Join(m_array, "")
  37. End Property
  38. End Class
  39. Function StringBuilder()
  40. set StringBuilder = new StringBuilder_Class
  41. End Function
  42. '=======================================================================================================================
  43. ' Misc
  44. '=======================================================================================================================
  45. Function Excerpt(text, length)
  46. Excerpt = Left(text, length) & " ..."
  47. End Function
  48. Function IsBlank(text)
  49. If IsObject(text) then
  50. If text Is Nothing then
  51. IsBlank = true
  52. Else
  53. IsBlank = false
  54. End If
  55. Else
  56. If IsEmpty(text) or IsNull(text) or Len(text) = 0 then
  57. IsBlank = true
  58. Else
  59. IsBlank = false
  60. End If
  61. End If
  62. End Function
  63. %>

Powered by TurnKey Linux.