Results 1 to 8 of 8

Thread: clsBSTR - the ultimate string class

Threaded View

  1. #1

    Thread Starter
    VB6, XHTML & CSS hobbyist Merri's Avatar
    Join Date
    Oct 2002
    Location
    Finland
    Posts
    6,654

    clsBSTR - the ultimate string class

    This is the first "full" release of this class. You've probably sometimes heard of StringBuilder classes or about cString class that offer a better performance for concatenating strings. This class does this, but it does it much better than other classes of this kind, being both easy to use and fast. Besides concatenation there are many more features included within this class.

    Sample syntaxes:
    Code:
    Dim strTemp As New clsBSTR
    
    strTemp = "Hello!"
    MsgBox strTemp
    ' output: the obvious
    
    MsgBox strTemp.SetValue("this line has LOTS OF STUFF!").PCase
    ' output: "This Line Has Lots Of Stuff!"
    
    MsgBox strTemp.SetValue("One?").Replicate(5)
    ' output: "One?One?One?One?One?"
    
    strTemp = "AAABCCC"
    strTemp.Middle(0, 3) = "_"
    strTemp.Middle(strTemp.Length - 3, 3) = "_"
    MsgBox strTemp
    ' output: "_B_"
    
    strTemp = "ABC"
    strTemp.Middle(2, 0) = "[surprise!]"
    strTemp.Middle(1, 0) = "[a big]"
    MsgBox strTemp
    ' output: "A[a big]B[surprise!]C"
    
    strTemp = "1|2|3|2|1|4|5|6|9|8|7|8|9"
    MsgBox strTemp.Trim "123789|"
    ' output: "4|5|6"
    This isn't a final release of the class: there is room for new features and for further optimizations, although at this point of performance the latter isn't just as important.

    This thread is open for feature requests and generic feedback. If you wish to talk about the optimization tricks or you have ideas on what could be done better, check the thread over at Code It Better forum.
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width