#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2011
    Posts
    10
    Rep Power
    0

    How to change remaining characters in a string?


    Hi. I have to change the remaining characters to '...' when the string is more the 15. How do i do that?

    Example:
    str = "This is a sample string"

    result:
    "This is a sampl..."

    Thanks in advance.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2004
    Posts
    194
    Rep Power
    329
    Check first if the strTest.Length() is more than 15, then use Mid function, something like...
    Code:
    Dim strTest As String = "This is a sample string"
    strTest = Mid(strTest, 1, 15)
    MsgBox(strTest & "...")
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2011
    Posts
    10
    Rep Power
    0
    That helps. Thank you very much.

IMN logo majestic logo threadwatch logo seochat tools logo