[Gambas-user] Lenght of a string

Oliver Etchebarne Bejarano oliver at ...3593...
Wed Apr 6 16:00:06 CEST 2016


You are writing utf-8 characteres, so the 'é' and the 'ô' are two bytes 
long ("José Antônio" is 12 chars but 14 bytes long).

I think you should either remove the tildes, or use UTF-8 string 
functions (like String.len() instead of len()) for the calculations, and 
then change the encoding to something like latin-1. And hope that your 
system can understand the new encoding well...


El 06/04/16 a las 07:48, José Monteiro escribió:
> len("José Antônio") = 14
> I need to fill a text file and upload it to a system in order to make an
> invoice.
> The field "name" must have lenght = 115. If shorter than that you must
> complement it with spaces.
> So:
>
>   for i = 1 to (115 - len(name))
>     name = name & Space$(1)
>   next
>
> The result is --> "José Antônio" + 101 spaces
>
> But, in the text file, "José Antônio" + 101 spaces is considered as having
> lenght = 113, not 115.
> The text file, then, is rejected by the system, because the following fields
> are not being correctly interpreted.
> Any sugestions?
> Thanks in advance
>
>
>
> --
> View this message in context: http://gambas.8142.n7.nabble.com/Lenght-of-a-string-tp55855.html
> Sent from the gambas-user mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user

-- 
	
Oliver Etchebarne Bejarano
Responsable del Área de TIC
Ica Server E.I.R.L. <http://icaserver.com/>




More information about the User mailing list