ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   extracting chars from strings (Visual Basic) (https://www.excelbanter.com/excel-programming/435326-extracting-chars-strings-visual-basic.html)

Robert Crandal

extracting chars from strings (Visual Basic)
 
If I have a string variable in Visual Basic, which function do I
use to extract/or read a single character in the string??

For example, given the following string:

myString = "ABCDEFG"

How can I instruct Visual Basic to extract the 4th character from
the string??? (which is letter/char 'D')

(In C++, this is equivalent to myString[4])

Thank you!




Roger Govier[_3_]

extracting chars from strings (Visual Basic)
 
Hi Robert

Mid(mystring,4,1)

--
Regards
Roger Govier

"Robert Crandal" wrote in message
...
If I have a string variable in Visual Basic, which function do I
use to extract/or read a single character in the string??

For example, given the following string:

myString = "ABCDEFG"

How can I instruct Visual Basic to extract the 4th character from
the string??? (which is letter/char 'D')

(In C++, this is equivalent to myString[4])

Thank you!




__________ Information from ESET Smart Security, version of virus
signature database 4536 (20091023) __________

The message was checked by ESET Smart Security.

http://www.eset.com




__________ Information from ESET Smart Security, version of virus signature database 4536 (20091023) __________

The message was checked by ESET Smart Security.

http://www.eset.com




Mike H

extracting chars from strings (Visual Basic)
 
Hi,

MyString = "ABCDEFG"
MyChar = Mid(MyString, 4, 1)
Mike

"Robert Crandal" wrote:

If I have a string variable in Visual Basic, which function do I
use to extract/or read a single character in the string??

For example, given the following string:

myString = "ABCDEFG"

How can I instruct Visual Basic to extract the 4th character from
the string??? (which is letter/char 'D')

(In C++, this is equivalent to myString[4])

Thank you!



.



All times are GMT +1. The time now is 05:44 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com