Visual Basic Help

Discussion in 'OT Technology' started by RyeLou, May 25, 2005.

  1. RyeLou

    RyeLou OT Supporter

    Joined:
    May 12, 2004
    Messages:
    5,065
    Likes Received:
    0
    Location:
    Detroit-ish
    "word" is the variable I am using for a word typed into an inputbox. i need to take the first letter, last letter, and the word in upper and lower case and put it in a list box. i have all of them but the last letter. how do i do that since i dont know the length or what character it will be? the other ones i have are these:

    first = word.Substring(0, 1)

    upper = word.ToUpper

    lower = word.ToLower
     
  2. Ameter

    Ameter Active Member

    Joined:
    Mar 31, 2005
    Messages:
    97,795
    Likes Received:
    1
    Location:
    Calgary, AB
    im a C programmer myself, so i cant give a specific, but there must be a function to find the length of the string, in C, its called strlen... use that function, its simplicity from there
     
  3. Ameter

    Ameter Active Member

    Joined:
    Mar 31, 2005
    Messages:
    97,795
    Likes Received:
    1
    Location:
    Calgary, AB
    absolute worst case scenario, if you cant find the function (and there WILL be one) just write your own function that runs a while loop thru the string until it finds a null character (0), and then return the count
     
  4. Penetration

    Penetration OT Supporter

    Joined:
    Jan 7, 2004
    Messages:
    19,258
    Likes Received:
    0
    Location:
    MMM my ding ding dong
    in VB it's just len($whatever) I believe, i havent touched vb for a good 4 years though.
     
  5. poisonivvy

    poisonivvy New Member

    Joined:
    Aug 8, 2003
    Messages:
    1,446
    Likes Received:
    0
    Location:
    Washington State
    Len(Expression of String) as Integer

    So... just take the text from the word, take the char/substring from the len and you should be golden.
     
  6. 5Gen_Prelude

    5Gen_Prelude There might not be an "I" in the word "Team", but

    Joined:
    Mar 14, 2000
    Messages:
    14,519
    Likes Received:
    1
    Location:
    Vancouver, BC, CANADA
    Last = word.substring(len(word)-1,1)

    or

    Last = right(word,1)

    or

    Last = mid(word,len(word),1)
     
  7. kingtoad

    kingtoad OT Supporter

    Joined:
    Sep 2, 2003
    Messages:
    55,918
    Likes Received:
    10
    Location:
    Los Angeles
    I told you how to accomplish this last week. I thought you said you got it working?
     

Share This Page