KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Looking inwards: How many characters of code does this application have?
PRODUCT: 4D | VERSION: 15.1 | PLATFORM: Mac & Win
Published On: March 16, 2016


Here is a code snippet that returns the total number of printable characters found in the methods of the calling application:

// UTIL_SizeOfAllMethods
// returns the total number of printable characters found in all methods
C_LONGINT($total;$count)
ARRAY TEXT($MethodNames_at;0)
ARRAY TEXT($MethodCodes_at;0)
METHOD GET NAMES($MethodNames_at;*)
METHOD GET CODE($MethodNames_at;$MethodCodes_at;*)
$count:=Size of array($MethodNames_at)
$total:=0
For ($a;1;$count)
   $total:=$total+Length($MethodCodes_at{$a})
End for
$0:=$total


If the code snippet above is saved as UTIL_SizeOfAllMethods then it could be used like this:

ALERT(String(UTIL_SizeOfAllMethods ;"###,###,###,##0")+" printable characters found.")