How can I extract the first 6 characters of a string?
e.g.
str1 = "abcdefghijklmnopqrstu"
=>str2 = "abcdef"
Printable View
How can I extract the first 6 characters of a string?
e.g.
str1 = "abcdefghijklmnopqrstu"
=>str2 = "abcdef"
Code:str2 = Left(str1,6)
If performance will become an issue one day, you can better use Left$(str1,6). This will return a string value, while the Left function returns a variant value, which is converted to a string afterwards.