Bookshelf Home | Contents | Index | PDF |
Siebel VB Language Reference > VB Language Reference > Mid StatementMid replaces part (or all) of one string with another, starting at a specified location. SyntaxMid (stringVar, start[, length]) = string ReturnsThe value of stringVar with string embedded at the specified location. UsageIf the length argument is omitted, or if there are fewer characters in string than specified in length, then Mid replaces the characters from the start to the end of the string. If start is larger than the number of characters in the indicated stringVar, then Mid appends string to stringVar. If length is greater than the length of string, then length is set to the length of string. If start is greater than the number of characters in stringVar, an illegal function call error occurs at runtime. If length plus start is greater than the length of stringVar, then only the characters up to the end of stringVar are replaced. Mid never changes the number of characters in stringVar. The index of the first character in a string is 1. ExampleThis example uses the Mid statement to replace the last name in a user-entered string with asterisks (*). Sub Button_Click See AlsoLCase Function |
Siebel VB Language Reference |