PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
  • Formatting according to the languages used
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
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, etc.
Versions 15 and later
Android This function is now available for Android applications.
Java This function is now available for Java applications.
New in version 15
Android This function is now available for Android applications.
Java This function is now available for Java applications.
Android This function is now available for Android applications.
Java This function is now available for Java applications.
Versions 17 and later
iPhone/iPad This function is now available for iPhone/iPad applications.
New in version 17
iPhone/iPad This function is now available for iPhone/iPad applications.
iPhone/iPad This function is now available for iPhone/iPad applications.
Versions 18 and later
Android Widget This function is now available in Android Widget mode.
New in version 18
Android Widget This function is now available in Android Widget mode.
Android Widget This function is now available in Android Widget mode.
Versions 21 and later
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
New in version 21
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Versions 26 and later
Apple Watch This function is now available for Apple Watch applications.
New in version 26
Apple Watch This function is now available for Apple Watch applications.
Apple Watch This function is now available for Apple Watch applications.
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.
sizeKBSize converted to kilobytes.
sizeMBSize converted to megabytes.
sizeGBSize converted to gigabytes.
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: wd260std.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