ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / String functions
  • Formatting according to the languages used
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Converts a size in bytes to a string with human-readable units such as kilobytes, megabytes or terabytes. This function is used to format the result returned by fSize, FTPSize, ...
Example
nSize is int = 123596900
Info(LengthToString(nSize)) // Displays "117.87 MB"
Info(LengthToString(nSize, sizeKB)) // Displays "120700.10 KB"
Info(LengthToString(nSize, sizeGB)) // Displays "0.12 GB"
Syntax
<Result> = LengthToString(<Size to convert> [, <Display format>])
<Result>: Character string
  • Conversion result. This result has 2 digits after the decimal point.
  • Empty string ("") if an error occurred.
<Size to convert>: Integer
Size to convert (in bytes).
<Display format>: Optional Integer constant
By default, the string is returned in the most readable unit. The following constants are used to force the use of a specific unit:
sizeBSize converted to bytes.
sizeGBSize converted to gigabytes.
sizeKBSize converted to kilobytes.
sizeMBSize converted to megabytes.
sizeTBSize converted to terabytes.
Remarks

Formatting according to the languages used

The formatting of the result depends on the characteristics of the languages defined in the project description ("Language" tab). You can change the file size units and/or the decimal separator.
Business / UI classification: Neutral code
Component: wd290std.dll
Minimum version required
  • Version 12
This page is also available for…
Comments
Exemplo fDirSize/LengthToString
Exemplo fDirSize/LengthToString

s_diretorio is string="E:\_clientes_atualizacoes\_Windev_Erp_Matos\"
n_tamanho_diretorio is int=fDirSize(s_diretorio)
EDT_texto=LengthToString(n_tamanho_diretorio,sizeB)+CR
EDT_texto+=LengthToString(n_tamanho_diretorio,sizeGB)+CR
EDT_texto+=LengthToString(n_tamanho_diretorio,sizeKB)+CR
EDT_texto+=LengthToString(n_tamanho_diretorio,sizeMB)+CR
EDT_texto+=LengthToString(n_tamanho_diretorio,sizeTB)+CR

//Blog com video e exemplo:
http://windevdesenvolvimento.blogspot.com.br/2016/09/curso-windev-arquivos-010-arquivos.html
https://www.youtube.com/watch?v=5PFR3pfXC2w
De matos AMARILDO
02 Sep. 2016

Last update: 05/26/2022

Send a report | Local help