| Got your strings knotted? |
| Strings are just made up of characters all in a row example afgrcdetset is a string of length 11 characters You need to define your variable as the string database Dim StrName As String You can manipulate strings using the VB code For example you might want to find the first character of the string FirstLetter = Left$(strName, 1) Here the Left signifies the left side of the string and the 1 picks the first character only In a similar way the last character can be selected using a variation of a above using Right$ Finding the middle is a little more tricky as you have to define the exact place. This can be done by finding the length of the string dividing by 2 and then selecting the very middle character (strName, Len(strName)/2,1) You of course need to combine this with the code for the middle part of the string Mid$ Things to think about: What do you do when the middle character is a space?? Hint ...you might need to think about if statements |