Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 309
Default 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!



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,480
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default 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!



.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Programmatic access to visual basic project via Visual FoxPro Jim Rech Excel Programming 0 January 11th 07 01:53 PM
Make visual basic truely visual! GraphicalGuy Excel Programming 0 October 20th 06 05:53 PM
Can I run Visual Basic procedure using Excel Visual Basic editor? john.jacobs71[_2_] Excel Programming 3 December 26th 05 02:22 PM
changing the visual basic in office 2003 to visual studio net bigdaddy3 Excel Discussion (Misc queries) 1 September 13th 05 10:57 AM
extracting a single char from a string of chars Alan Excel Programming 2 August 17th 05 02:55 PM


All times are GMT +1. The time now is 09:06 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"