Results 1 to 6 of 6

Thread: [RESOLVED] [2005] Help With SubString Property

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2006
    Location
    UK
    Posts
    489

    Resolved [RESOLVED] [2005] Help With SubString Property

    Hi

    Well basically I want to extract all the characters from a variable, and I am using the substring propety to do that, I specify the starting character to be 75, but as the variable is always gonig to hold different lengths of data, I cant specify a fixed value, so what should I do?

    Code:
    If ObjProblemDescription.Length > 75 Then
    
     ObjProblemDescription2 = ObjProblemDescription.Substring(75, ,> 75???)
    Learning C♯

    Data Binding & Bound Controls - Objects and wizards will never be as intelligent as you, do it yourself! (Unless your Pro)

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: [2005] Help With SubString Property

    How will you know, each time, what the number is, or, will you know is time what the number is?

  3. #3
    Banned
    Join Date
    Nov 2005
    Posts
    2,367

    Re: [2005] Help With SubString Property

    Code:
    ObjProblemDescription.Substring(75, ObjProblemDescription.Length - 75)

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2006
    Location
    UK
    Posts
    489

    Re: [2005] Help With SubString Property

    Quote Originally Posted by Hack
    How will you know, each time, what the number is, or, will you know is time what the number is?
    Well first this is only done if my variable contains 75 or more characters, I have no idea how many characters it will contain TBH, however mabe if I remove characters 1 - 74, and leave the rest, that might work?

    SevenHalo, I dont get what your code is suppost to do?
    Learning C♯

    Data Binding & Bound Controls - Objects and wizards will never be as intelligent as you, do it yourself! (Unless your Pro)

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2006
    Location
    UK
    Posts
    489

    Re: [2005] Help With SubString Property

    Resolved

    Just didnt specify a length lol

    Code:
    ObjProblemDescription2 = ObjProblemDescription.Substring(75)
    Learning C♯

    Data Binding & Bound Controls - Objects and wizards will never be as intelligent as you, do it yourself! (Unless your Pro)

  6. #6
    Banned
    Join Date
    Nov 2005
    Posts
    2,367

    Re: [RESOLVED] [2005] Help With SubString Property

    The first parameter is the start index, the second if how far you want to substring toparse out.

    If your string is 100 characters and you start at 75 (76 actually if you convert from zero based indexes), how would you determine how many characters are left? The length of your string minus the number in which you started.

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