[Gambas-user] Boxed string question
Cedron Dawg
cedron at exede.net
Wed Sep 11 15:11:51 CEST 2019
Because of the "Syntax Sugar" string concatenation thing I would do it somewhat like this:
'==================================================
Private Function ProperCase(value As String) As String
Dim O As Stream, Q As String
O = Open String For Write
Dim ss As String[] = Split(value, " ")
For Each s As String In ss
Print #O, String.UCaseFirst(s); " ";
Next
Q = Close #O
Return RTrim(Q)
End
'==================================================
I second the call for a built in "ProperCase" function.
It would also be nice to have a set of calls back and forth between a ProperCase name and a DB safe name, i.e. all lower case with underscored separators.
HomeAddress <===> home_address
Ced
----- Original Message -----
From: "Gianluigi" <bagonergi at gmail.com>
....
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
.....
Benoit, how about adding a new string function?
Regards
Gianluigi
----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----
More information about the User
mailing list