Len() returns length in bytes and String.Len() returns length in
characters. Use latter for UTF-8 strings.
See the documentation.

> sText = String.Mid(PrintedTextBox.Text, 1, String.Len(PrintedTextBox))

I assume you mean:
sText = String.Mid(PrintedTextBox.Text, 1, String.Len(PrintedTextBox.Text))

But still that doesn't make any sense, since the result is exactly same as
with:
sText = PrintedTextBox.Text

It's just hard way to do the same. I don't understand what you are trying
to do.


Jussi



On Sun, Mar 22, 2015 at 10:07 PM, John Rose <[email protected]>
wrote:

> Jussi,
>
> I spoke too soon. There seems to be one problem with having non-ASCII
> characters entered into a TextBox. If I make a string variable (sText in
> my attached Test project) equal to the Text property of the TextBox
> (PrintedTextBox.Text in my Test project), then the string variable needs
> to have String methods applied to it when using Len etc. Am I correct?
> Possible solution is to use sText = String.Mid(PrintedTextBox.Text, 1,
> String.Len(PrintedTextBox)) instead of sText = PrintedTextBox.Text, but
> I guess that would mean that String methods would also have to be used
> on sText.
>
> John
>
>
> On 18/03/15 07:31, John Rose wrote:
> > Jussi,
> >
> > Since you are top posting, I shall also top post: hopefully, it won't
> > start another long discussion. Thanks for the suggestion about using
> > String methods.
> >
> > The Test app now works properly using the String methods. Also, the =
> > and &= operators work OK for strings containing non-ASCII characters
> > such as $.
> >
> > John
> >
> >
> >
> > On 17/03/15 15:50, Jussi Lahtinen wrote:
> >> Oh I missed you are using Mid() function, it is only for ASCII
> characters,
> >> use String.Mid() instead.
> >>
> >>
> >> Jussi
> >>
> >> On Tue, Mar 17, 2015 at 4:33 PM, John Rose <[email protected]>
> >> wrote:
> >>
> >>> On 17/03/15 13:33, Jussi Lahtinen wrote:
> >>>> Maybe the console takes only ASCII characters?
> >>>>
> >>>>
> >>>> Jussi
> >>>>
> >>>> On Tue, Mar 17, 2015 at 3:00 PM, John Rose <[email protected]
> >
> >>>> wrote:
> >>>>
> >>>>> When entering a £ character (i.e. the British pound symbol not the
> >>>>> American one) into a TextArea or TextBox, it seems to be
> 'interpreted'
> >>>>> as a funny looking question mark (i.e. sort of reverse black & white)
> >>>>> when it's shown on the Console using a Print statement (actioned in a
> >>>>> Change event). I wonder if this could be due to Gambas/Ubuntu
> regarding
> >>>>> my keyboard as American even though it's 'installed' within Ubuntu as
> >>>>> British.
> >>>>>
> >>>>> --
> >>>>>
> >>>>> John
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>
> ------------------------------------------------------------------------------
> >>>>> Dive into the World of Parallel Programming The Go Parallel Website,
> >>>>> sponsored
> >>>>> by Intel and developed in partnership with Slashdot Media, is your
> hub
> >>> for
> >>>>> all
> >>>>> things parallel software development, from weekly thought leadership
> >>> blogs
> >>>>> to
> >>>>> news, videos, case studies, tutorials and more. Take a look and join
> the
> >>>>> conversation now. http://goparallel.sourceforge.net/
> >>>>> _______________________________________________
> >>>>> Gambas-user mailing list
> >>>>> [email protected]
> >>>>> https://lists.sourceforge.net/lists/listinfo/gambas-user
> >>>>>
> >>>>>
> >>>
> ------------------------------------------------------------------------------
> >>>> Dive into the World of Parallel Programming The Go Parallel Website,
> >>> sponsored
> >>>> by Intel and developed in partnership with Slashdot Media, is your hub
> >>> for all
> >>>> things parallel software development, from weekly thought leadership
> >>> blogs to
> >>>> news, videos, case studies, tutorials and more. Take a look and join
> the
> >>>> conversation now. http://goparallel.sourceforge.net/
> >>>> _______________________________________________
> >>>> Gambas-user mailing list
> >>>> [email protected]
> >>>> https://lists.sourceforge.net/lists/listinfo/gambas-user
> >>> I don't think that it's caused by Print statements to the Console. When
> >>> I amend the Change event coding (see below) for the TextArea and run
> the
> >>> app with just a £ character keyed into the TextArea, I get on the
> >>> Console (with the £ character displayed OK in the TextArea):
> >>> X
> >>> sCh=�
> >>> Y
> >>> ZZ
> >>> *
> >>> ***
> >>>
> >>> The coding is:
> >>>   Dim i As Integer
> >>>   Dim sCh As String
> >>>   For i = 1 To PrintedTextArea.Length
> >>>     sCh = Mid(PrintedTextArea.Text, i, 1)
> >>>     Print "sCh=" & sCh
> >>>     Print "X"
> >>>     Print "sCh=" & sCh
> >>>     Print "Y"
> >>>     sCh = Mid(Last.Text, i, 1)
> >>>     Select sCh
> >>>       Case "£", "?", "&", ".", "/", "="
> >>>         Print "Z"
> >>>       Case Else
> >>>         Print "ZZ"
> >>>     End Select
> >>>     Print "*"
> >>>   Next
> >>>   Print "***"
> >>>
> >>> Which implies that the above Select statement is not recognising an
> >>> input £ as it is regarded it as the funny question mark when input into
> >>> the TextArea. Looking at www.asciitable.com, Chr(35) is # which I
> would
> >>> assume that Ubuntu should regard as a £ on a British keyboard.  There
> >>> seems to be a bug: either on Ubuntu or Gambas. Which is it?
> >>>
> >>>
> >>>
> ------------------------------------------------------------------------------
> >>> Dive into the World of Parallel Programming The Go Parallel Website,
> >>> sponsored
> >>> by Intel and developed in partnership with Slashdot Media, is your hub
> for
> >>> all
> >>> things parallel software development, from weekly thought leadership
> blogs
> >>> to
> >>> news, videos, case studies, tutorials and more. Take a look and join
> the
> >>> conversation now. http://goparallel.sourceforge.net/
> >>> _______________________________________________
> >>> Gambas-user mailing list
> >>> [email protected]
> >>> https://lists.sourceforge.net/lists/listinfo/gambas-user
> >>>
> >>
> ------------------------------------------------------------------------------
> >> Dive into the World of Parallel Programming The Go Parallel Website,
> sponsored
> >> by Intel and developed in partnership with Slashdot Media, is your hub
> for all
> >> things parallel software development, from weekly thought leadership
> blogs to
> >> news, videos, case studies, tutorials and more. Take a look and join the
> >> conversation now. http://goparallel.sourceforge.net/
> >> _______________________________________________
> >> Gambas-user mailing list
> >> [email protected]
> >> https://lists.sourceforge.net/lists/listinfo/gambas-user
> >
>
>
>
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming The Go Parallel Website,
> sponsored
> by Intel and developed in partnership with Slashdot Media, is your hub for
> all
> things parallel software development, from weekly thought leadership blogs
> to
> news, videos, case studies, tutorials and more. Take a look and join the
> conversation now. http://goparallel.sourceforge.net/
> _______________________________________________
> Gambas-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
>
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Gambas-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to