Re: Counting characters and splitting string



1. The Instr function finds the occurrence of one string within another.
The OP needs to build a routine around the InStr function.
2. Brain was working faster than fingers! MyArray(i) = Mid(i,1) should be:
MyArray(i) = Mid([MyString],i,1)

PC Datasheet
Providing Customers A Resource For Help With Access, Excel And Word
Applications
resource@xxxxxxxxxxxxxxx




"Larry Linson" <bouncer@xxxxxxxxxxxxx> wrote in message
news:mhfoi.516$7w.381@xxxxxxxxxxx
Could you clarify, Steve? Your first suggestion appears incomplete and
the second does not seem to work, even if MyString is
dimensioned/provided.

"Steve" <Sorry@xxxxxxxxxxxxxxxxxxxx> wrote in message
news:AV9oi.8859$rR.6112@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
1. Look at the Instr function in the Help file.
2. Dim i As Integer
Dim MyArray As Variant
For i = 1 to Len(MyString)
MyArray(i) = Mid(i,1)
Next i

PC Datasheet
Providing Customers A Resource For Help With Access, Excel And Word
Applications
resource@xxxxxxxxxxxxxxx





"John" <xxx@xxxxxxx> wrote in message
news:f7r88a$jg4$1@xxxxxxxxxxxxxxxxxxxxxx
1. Is there an easy function in VB to count for instance the number of
A's in a string?
2. Is there an easy funtion in VB to pull all characters out of a string
into an array? (I tried the split function but that needs a separator.)
Thanks,
john







.



Relevant Pages

  • Re: Get address from body of message macro ?
    ... "Stacy" wrote in message ... > 'Using the Instr Function this code looks for the brackets and will give you> 'the positions of the variables. ... > End Sub ... This can be used to determining the start>> and end positions of a specific string. ...
    (microsoft.public.outlook.program_vba)
  • Re: Get address from body of message macro ?
    ... I have writen the following code based the advice given here. ... 'Using the Instr Function this code looks for the brackets and will give you ... > Hi Stacy, ... > and end positions of a specific string. ...
    (microsoft.public.outlook.program_vba)
  • Re: Counting characters and splitting string
    ... Look at the Instr function in the Help file. ... Dim MyArray As Variant ... Is there an easy funtion in VB to pull all characters out of a string ...
    (comp.databases.ms-access)
  • Re: function Instr
    ... of the character or string in the third argument. ... Dim OriginalString As String ... >> Now I want to get, with the instr function, the first word of the ...
    (microsoft.public.word.vba.beginners)
  • Re: VBScript querying a file and outputing a text file
    ... the InStr function is case sensitive. ... If several lines do not have the target string, ... Dim strNextLine, intLineFinder ... Const ForReading = 1 ...
    (microsoft.public.scripting.vbscript)