[Gambas-user] Boxed string question

Gianluigi bagonergi at gmail.com
Wed Sep 11 09:43:03 CEST 2019


Il giorno mer 11 set 2019 alle ore 00:56 Benoît Minisini <g4mba5 at gmail.com>
ha scritto:

> Le 11/09/2019 à 00:41, Tobias Boege a écrit :
> > And I have a question too: Since when can you use a string like an array?
>
> Since 3.12.
>
> > Is that documented? At least it seems like it is a read-only array, which
> > complicates the solution to the second issue...
>
> It's only documented in the Mid$() and Len() wiki pages. And only
> reading the array is allowed.
>
> Regards,
>
> --
> Benoît Minisini
>

Tobias & Benoit,
thank you very much.

Damn, and to think that I translated wiki pages not long time ago.
I have a particular feature, I don't even understand what I write, sigh!

What do you think about these solutions (obviously the second solution is
not mine :-P)?

Private Function ProperCase(value As String) As String

  Dim ss As String[] = Split(value, " ")

  value = ""
  For Each s As String In ss
    value &= String.UCaseFirst(s) & " "
  Next
  Return RTrim(value)

End

Private Function ProperCase(value As String) As String

  Dim bb As Byte[]

  bb = Byte[].FromString(value)
  For i As Integer = 0 To bb.Max - 1
    If bb[i + 1] \ bb[i] = 3 Then bb[i + 1] = bb[i + 1] - 32
  Next
  Return bb.ToString(0, bb.Count)

End

Benoit, how about adding a new string function?

Regards
Gianluigi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20190911/11946481/attachment.html>


More information about the User mailing list