PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • 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 length expressed in bytes into a character string formatted in kilobytes, megabytes or terabytes. This function is used to format the result returned by fSize, FTPSize, ...
Versions 15 and later
Android This function is now available for the Android applications.
Java This function is now available for the Java applications.
New in version 15
Android This function is now available for the Android applications.
Java This function is now available for the Java applications.
Android This function is now available for the Android applications.
Java This function is now available for the Java applications.
Versions 17 and later
iPhone/iPad This function is now available for the iPhone/iPad applications.
Universal Windows 10 App This function is now available for the Windows Phone applications.
New in version 17
iPhone/iPad This function is now available for the iPhone/iPad applications.
Universal Windows 10 App This function is now available for the Windows Phone applications.
iPhone/iPad This function is now available for the iPhone/iPad applications.
Universal Windows 10 App This function is now available for the Windows Phone applications.
Versions 18 and later
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
New in version 18
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Versions 21 and later
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
WEBDEV - Browser code This function is now available in browser code.
New in version 21
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
WEBDEV - Browser code This function is now available in browser code.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
WEBDEV - Browser code This function is now available in browser code.
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 displays 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 easiest unit to read. The following constants are used to force the use of a specific unit:
sizeBSize converted into bytes.
sizeKBSize converted into kilobytes.
sizeMBSize converted into megabytes.
sizeGBSize converted into gigabytes.
sizeTBSize converted into 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 have the ability to modify the units used for the file size and/or for the decimal separator.
Components
WINDEVWEBDEV - Server codeReports and Queries wd230std.dll
Windows Mobile wp230std.dll
WEBDEV - Browser code WDJS.DLL
Java wd230java.jar
Linux wd230std.so
Android wd230android.jar
Minimum required version
  • 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
Sep. 02 2016