From: Helmut Meukel on
"Bill Betournay" <bill(a)REMOVEdatapacks.com> schrieb im Newsbeitrag
news:%23wndw1CyKHA.5292(a)TK2MSFTNGP06.phx.gbl...
> Good Morning guys. Thank you both for your offerings. MikeD, I was stepping it
> through building my solution and then discovered the problem of parsing out
> the ?? Object ( think it's a carriage return) from the list. I hope I'm not
> missing your point.
>
> And Mike Williams, that example you provided was great in the sense that you
> seem to understand. Problem is the ability to capture the carriage return.
> That's my issue. You example takes my list and rips it through a bunch of
> loops but returns the same list. In fact the string example below was the
> result of your example. It's not capturing the stuff between the numbers
> either. I don't understand why I can't seem to get the whatever it is between
> each set of numbers
>
> Thank you both and yes, this may have changed a little since my OP because
> I've used your examples and learned a little more. :-)
>
> here's what I've tried
>
> Replace(myInputStr, vbCr, ",")
> Replace(myInputStr, vbCrLf, ",")
> Replace(myInputStr, vbCr, ",")
> Replace(myInputStr, Chr$(13), ",")
> Replace(myInputStr, Chr(13), ",")
>
> here's an example of a string I have.
> "8
>
>
> 8.1
> 8.2
> 8.3
> 8.4
> 8.5
> 8.6
> 8.7
> 8.8
> 8.9
> 8.10
> 8.11
> 8.12
> 8.13
> 8.14
> 8.15
> 8.16
> 8.17
> 8.18
> 8.19
> 8.20
> 8.21
> 8.22
> 8.23
> 8.24
> 8.25
> 8.26"
>
> and ultimately here what I would like
> "8,8.1,8.2,8.3,8.4,8.5,8.6,8.7,8.8,8.9,8.10,8.11,8.12,8.13,8.14,8.15,8.16,8.17,8.18,8.19,8.20,8.21,8.22,8.23,8.24,8.25,8.26"
>
> Does that clear
>


Bill,

What you should have done first place is to check which characters
are actually in your string.
Something like this:
for i =1 to len(teststring)
Debug.Print Asc(mid(teststring, i, 1))
next
Step with F8 through this loop, after a few steps you'll _know_ what
to expect, CR, LF, space, or any combination of these. Maybe you'll
even find it's no ordinary space but a Chr$(160), which just looks
like a space.

One comment on your code:
did you really run those replace statements in this order?
Then you replaced first the CR in any CRLF pair in your string,
so the second statement couldn't find CRLF anymore. But you never
replaced the remaining LF if there was any CRLF originally!

Helmut.

From: Larry Serflaten on

"Bill Betournay" <bill(a)REMOVEdatapacks.com> wrote

> and ultimately here what I would like
> "8,8.1,8.2,8.3,8.4,8.5,8.6,8.7,8.8,8.9,8.10,8.11,8.12,8.13,8.14,8.15,8.16,8.17,8.18,8.19,8.20,8.21,8.22,8.23,8.24,8.25,8.26"
>

It seems to me you could do something like that in place:

LFS

Dim src As Long, dst As Long
Dim nonDigit As Boolean, Comma As Boolean
Dim text As String

' Test data
text = "8 " & vbCrLf & " 8.1 " & vbCrLf & "8.2" & vbCrLf & "8.3"

Debug.Print "STARTING WITH"; vbCrLf
Debug.Print text

' Init variables
src = 1
dst = 1
Comma = False

' Test first character (nonDigit is True if not a number or period)
nonDigit = Left$(text, 1) Like "[!1-9.]"

While src <= Len(text)
If nonDigit Then
' Skip non digit
src = src + 1
' Add comma if not present
If Not Comma Then
Mid(text, dst, 1) = ","
dst = dst + 1
Comma = True
End If
Else
' Keep digit
Mid(text, dst, 1) = Mid(text, src, 1)
src = src + 1
dst = dst + 1
Comma = False
End If
' Test next character
nonDigit = Mid$(text, src, 1) Like "[!1-9.]"
Wend
' Shorten to actual length
text = Left$(text, dst - 1)

Debug.Print "ENDING WITH"; vbCrLf
Debug.Print text


From: mayayana on
If you're sure that there are only Cr and
Lf, in addition to spaces, then why not
replace each of those with a space, then run
Mike Williams's loop to delete extra spaces,
then replace all spaces with commas?


> Good Morning guys. Thank you both for your offerings. MikeD, I was
stepping
> it through building my solution and then discovered the problem of
parsing
> out the ?? Object ( think it's a carriage return) from the list. I hope
I'm
> not missing your point.
>
> And Mike Williams, that example you provided was great in the sense that
you
> seem to understand. Problem is the ability to capture the carriage return.
> That's my issue. You example takes my list and rips it through a bunch of
> loops but returns the same list. In fact the string example below was the
> result of your example. It's not capturing the stuff between the numbers
> either. I don't understand why I can't seem to get the whatever it is
> between each set of numbers
>
> Thank you both and yes, this may have changed a little since my OP because
> I've used your examples and learned a little more. :-)
>
> here's what I've tried
>
> Replace(myInputStr, vbCr, ",")
> Replace(myInputStr, vbCrLf, ",")
> Replace(myInputStr, vbCr, ",")
> Replace(myInputStr, Chr$(13), ",")
> Replace(myInputStr, Chr(13), ",")
>
> here's an example of a string I have.
> "8
>
>
> 8.1
> 8.2
> 8.3
> 8.4
> 8.5
> 8.6
> 8.7
> 8.8
> 8.9
> 8.10
> 8.11
> 8.12
> 8.13
> 8.14
> 8.15
> 8.16
> 8.17
> 8.18
> 8.19
> 8.20
> 8.21
> 8.22
> 8.23
> 8.24
> 8.25
> 8.26"
>
> and ultimately here what I would like
>
"8,8.1,8.2,8.3,8.4,8.5,8.6,8.7,8.8,8.9,8.10,8.11,8.12,8.13,8.14,8.15,8.16,8.
17,8.18,8.19,8.20,8.21,8.22,8.23,8.24,8.25,8.26"
>
> Does that clear
>
> "Mike Williams" <Mike(a)WhiskyAndCoke.com> wrote in message
> news:eHXD19ByKHA.984(a)TK2MSFTNGP05.phx.gbl...
> > "MikeD" <nobody(a)nowhere.edu> wrote in message
> > news:eHdB1T8xKHA.4752(a)TK2MSFTNGP04.phx.gbl...
> >
> >
> >> Whatever happened to trying to get someone to think on their
> >> own? <g> I could have given code in my answer. I chose not
> >> to in favor of giving hints and advice for him to work it out
> >> himself. He's not going to learn anything from hand-outs (except
> >> to come to the newsgroups to be given code) . . .
> >> (not trying to start anything, Mike. Just making a light-hearted
> >> comment, so don't get all defensive. <g>)
> >
> > Actually you're quite right, Mike. I really should have done what you
> > suggested, especially after taking into account the faitly obvious
> > learning stage of the OP. I hang my head in shame ;-)
> >
> > Mike
> >
> >
>
>


From: Bill Betournay on
Sweet, thank you Helmut.

I think we're on to something. It's 10 not 13.

no, I didn't run those that order. I was only showing you the ones I had
tried.

I'll get back to ya. this may be the answer.

Bill

"Helmut Meukel" <NoSpam(a)NoProvider.de> wrote in message
news:O67wrHDyKHA.5364(a)TK2MSFTNGP05.phx.gbl...
> "Bill Betournay" <bill(a)REMOVEdatapacks.com> schrieb im Newsbeitrag
> news:%23wndw1CyKHA.5292(a)TK2MSFTNGP06.phx.gbl...
>> Good Morning guys. Thank you both for your offerings. MikeD, I was
>> stepping it through building my solution and then discovered the problem
>> of parsing out the ?? Object ( think it's a carriage return) from the
>> list. I hope I'm not missing your point.
>>
>> And Mike Williams, that example you provided was great in the sense that
>> you seem to understand. Problem is the ability to capture the carriage
>> return. That's my issue. You example takes my list and rips it through a
>> bunch of loops but returns the same list. In fact the string example
>> below was the result of your example. It's not capturing the stuff
>> between the numbers either. I don't understand why I can't seem to get
>> the whatever it is between each set of numbers
>>
>> Thank you both and yes, this may have changed a little since my OP
>> because I've used your examples and learned a little more. :-)
>>
>> here's what I've tried
>>
>> Replace(myInputStr, vbCr, ",")
>> Replace(myInputStr, vbCrLf, ",")
>> Replace(myInputStr, vbCr, ",")
>> Replace(myInputStr, Chr$(13), ",")
>> Replace(myInputStr, Chr(13), ",")
>>
>> here's an example of a string I have.
>> "8
>>
>>
>> 8.1
>> 8.2
>> 8.3
>> 8.4
>> 8.5
>> 8.6
>> 8.7
>> 8.8
>> 8.9
>> 8.10
>> 8.11
>> 8.12
>> 8.13
>> 8.14
>> 8.15
>> 8.16
>> 8.17
>> 8.18
>> 8.19
>> 8.20
>> 8.21
>> 8.22
>> 8.23
>> 8.24
>> 8.25
>> 8.26"
>>
>> and ultimately here what I would like
>> "8,8.1,8.2,8.3,8.4,8.5,8.6,8.7,8.8,8.9,8.10,8.11,8.12,8.13,8.14,8.15,8.16,8.17,8.18,8.19,8.20,8.21,8.22,8.23,8.24,8.25,8.26"
>>
>> Does that clear
>>
>
>
> Bill,
>
> What you should have done first place is to check which characters
> are actually in your string.
> Something like this:
> for i =1 to len(teststring)
> Debug.Print Asc(mid(teststring, i, 1))
> next
> Step with F8 through this loop, after a few steps you'll _know_ what
> to expect, CR, LF, space, or any combination of these. Maybe you'll
> even find it's no ordinary space but a Chr$(160), which just looks
> like a space.
>
> One comment on your code:
> did you really run those replace statements in this order?
> Then you replaced first the CR in any CRLF pair in your string,
> so the second statement couldn't find CRLF anymore. But you never
> replaced the remaining LF if there was any CRLF originally!
>
> Helmut.


From: Nobody on
"Bill Betournay" <bill(a)REMOVEdatapacks.com> wrote in message
news:%23wndw1CyKHA.5292(a)TK2MSFTNGP06.phx.gbl...
> I was stepping it through building my solution

Are you using one of the dotnet based versions? Such as VB 2005/2008? If so,
you are in the wrong group. This group is for VB6 and earlier(VB Classic).
VB.Net and all dotnet groups have either "dotnet" or "vsnet" in the group
name. Please use the following group instead:

news://msnews.microsoft.com/microsoft.public.dotnet.languages.vb

MS broke compatibility after VB6, so code for VB6 may not work in
VB.Net/2005/2008, and in most cases, projects require a rewrite to be
upgraded or converted. See here for details:

http://en.wikipedia.org/wiki/Visual_Basic_.NET#Criticism


First  |  Prev  |  Next  |  Last
Pages: 1 2 3 4 5 6 7 8 9
Prev: Combobox Showing Right Justified
Next: Can't make exe