Revision history for KeyPgLen


Revision [26811]

Last edited on 2024-04-03 10:31:14 by fxm [added 'note']
Additions:
**Note:** When used with array names, ##**Len**## returns the length of the array datatype, but not the total number of its elements.
Deletions:
**Note:** When used with array names, ##**Len**## returns the length of the array datatype, but not the number of its elements.


Revision [26809]

Edited on 2024-04-03 09:31:06 by fxm [added 'note']
Additions:
**Note:** When used with array names, ##**Len**## returns the length of the array datatype, but not the number of its elements.
Deletions:
Note: When used with arrays, ##**Len**## returns the length of the array datatype, but not the number of its elements.


Revision [26806]

Edited on 2024-04-03 04:43:20 by fxm [added 'note']
Additions:
Note: When used with arrays, ##**Len**## returns the length of the array datatype, but not the number of its elements.
For clarity, it is recommended that you avoid this potential confusion, and use ##**Len**## on the array datatype doing ##**Len**(//Typeof//(//array//))##, rather than the array name only doing ##**Len**(//array//)##.


Revision [25560]

Edited on 2021-10-13 05:55:39 by fxm [formatted for .chm]
Additions:
##**Len**## was not returning the size of the data fields of a UDT.
When a variable from a given namespace was accessed with the namespace's name prefix, the argument to ##**Len**## had to be wrapped with parentheses to force it to be seen as an expression. For example ##Len((namespace_name.variable))##.
Deletions:
##**Len**## was not returning the size of the data fields of a UDT.
When a variable from a given namespace was accessed with the namespace's name prefix, the argument to ##**Len**## had to be wrapped with parentheses to force it to be seen as an expression. For example ##Len((namespace_name.variable))##.


Revision [25496]

Edited on 2021-10-12 03:31:39 by fxm [differences from versions previous to 1.08 transferred to the Version section]
Additions:
{{fbdoc item="filename" value="examples/manual/strings/len.bas"}}%%(freebasic)
%%
Deletions:
{{fbdoc item="filename" value="examples/manual/strings/len.bas"}}%%(freebasic)
%%


Revision [25484]

Edited on 2021-10-12 01:32:17 by fxm [differences from versions previous to 1.08 transferred to the Version section]
Additions:
Returns the size of an expression or [[DataType|DataType]] (including the data fields of a UDT) in bytes.
{{fbdoc item="ver"}}
- Before fbc 1.08.0:
##**Len**## was not returning the size of the data fields of a UDT.
When a variable from a given namespace was accessed with the namespace's name prefix, the argument to ##**Len**## had to be wrapped with parentheses to force it to be seen as an expression. For example ##Len((namespace_name.variable))##.
Deletions:
Returns the size of an expression or [[DataType|DataType]] (and the data fields of a UDT for fbc version >= 1.08) in bytes.
For fbc version < 1.08: When a variable from a given namespace is accessed with the namespace's name prefix, wrap the argument to ##**Len**## with parentheses to force it to be seen as an expression. For example ##Len((namespace_name.variable))##.


Revision [23773]

Edited on 2019-12-11 03:20:58 by fxm [predisposed for fbc version 1.08]
Additions:
Returns the size of an expression or [[DataType|DataType]] (and the data fields of a UDT for fbc version >= 1.08) in bytes.
For fbc version < 1.08: When a variable from a given namespace is accessed with the namespace's name prefix, wrap the argument to ##**Len**## with parentheses to force it to be seen as an expression. For example ##Len((namespace_name.variable))##.
Deletions:
Returns the size of an expression or [[DataType|DataType]] in bytes.
When a variable from a given namespace is accessed with the namespace's name prefix, wrap the argument to ##**Len**## with parentheses to force it to be seen as an expression. For example ##Len((namespace_name.variable))##.


Revision [22701]

Edited on 2019-06-10 08:26:41 by fxm [Cancelled previous update]
Additions:
When a variable from a given namespace is accessed with the namespace's name prefix, wrap the argument to ##**Len**## with parentheses to force it to be seen as an expression. For example ##Len((namespace_name.variable))##.
Deletions:
When a variable from a given namespace is accessed with the namespace's name prefix, wrap the argument to ##**Len**## with parentheses to force it to be seen as an expression (same for a member field in a type/union accessed with the instance's name prefix). For example ##Len((namespace_name.variable))##.


Revision [22699]

Edited on 2019-06-10 08:20:39 by fxm [Syntax for accessing a member field of a type/union is similar to the one for a variable in a namespace]
Additions:
When a variable from a given namespace is accessed with the namespace's name prefix, wrap the argument to ##**Len**## with parentheses to force it to be seen as an expression (same for a member field in a type/union accessed with the instance's name prefix). For example ##Len((namespace_name.variable))##.
Deletions:
When a variable from a given namespace is accessed with the namespace's name prefix, wrap the argument to ##**Len**## with parentheses to force it to be seen as an expression (same for a member field in a type/union). For example ##Len((namespace_name.variable))##.


Revision [22694]

Edited on 2019-06-10 07:56:11 by fxm [Syntax for accessing a member field of a type/union is similar to the one for a variable in a namespace]
Additions:
When a variable from a given namespace is accessed with the namespace's name prefix, wrap the argument to ##**Len**## with parentheses to force it to be seen as an expression (same for a member field in a type/union). For example ##Len((namespace_name.variable))##.
Deletions:
When a variable from a given namespace is accessed with the namespace's name prefix, wrap the argument to ##**Len**## with parentheses to force it to be seen as an expression. For example ##Len((namespace_name.variable))##.


Revision [22329]

Edited on 2018-06-08 14:28:08 by fxm [Added explanation on using the syntax LEN((namespace_name.variable))]
Additions:
When a variable from a given namespace is accessed with the namespace's name prefix, wrap the argument to ##**Len**## with parentheses to force it to be seen as an expression. For example ##Len((namespace_name.variable))##.


Revision [22005]

Edited on 2017-11-21 01:11:18 by JeffMarshall [fix page link name case]
Additions:
[[KeyPgDeclare|declare]] [[KeyPgFunction|function]] **Len** ( [[KeyPgByref|byref]] //expression// [[KeyPgAs|as]] [[KeyPgZstring|zstring]] ) [[KeyPgAs|as]] [[KeyPgInteger|integer]]
Deletions:
[[KeyPgDeclare|declare]] [[KeyPgFunction|function]] **Len** ( [[KeyPgByref|byref]] //expression// [[KeyPgAs|as]] [[KeyPgZString|zstring]] ) [[KeyPgAs|as]] [[KeyPgInteger|integer]]


Revision [20958]

Edited on 2016-03-13 04:16:18 by fxm [Formatting]

No Differences

Revision [20290]

Edited on 2016-02-10 16:01:59 by DkLwikki [Update link format]
Additions:
[[KeyPgDeclare|declare]] [[KeyPgFunction|function]] **Len** ( [[KeyPgByref|byref]] //expression// [[KeyPgAs|as]] [[KeyPgString|string]] ) [[KeyPgAs|as]] [[KeyPgInteger|integer]]
[[KeyPgDeclare|declare]] [[KeyPgFunction|function]] **Len** ( [[KeyPgByref|byref]] //expression// [[KeyPgAs|as]] [[KeyPgZString|zstring]] ) [[KeyPgAs|as]] [[KeyPgInteger|integer]]
[[KeyPgDeclare|declare]] [[KeyPgFunction|function]] **Len** ( [[KeyPgByref|byref]] //expression// [[KeyPgAs|as]] [[KeyPgWstring|wstring]] ) [[KeyPgAs|as]] [[KeyPgInteger|integer]]
[[KeyPgDeclare|declare]] [[KeyPgOperator|operator]] **Len** ( [[KeyPgByref|byref]] //expression// [[KeyPgAs|as]] [[DataType|datatype]] ) [[KeyPgAs|as]] [[DataType|datatype]]
[[KeyPgDeclare|declare]] [[KeyPgFunction|function]] **Len** ( //datatype// ) [[KeyPgAs|as]] [[KeyPgInteger|integer]]
//result// = **Len**( [[DataType|DataType]] )
A [[DataType|DataType]].
Returns the size of an expression or [[DataType|DataType]] in bytes.
##**Len**## returns the length of an expression or the size of a [[DataType|DataType]], in bytes.
In the first form, if ##//expression//## is of type ##[[KeyPgString|String]]##, ##[[KeyPgWstring|Wstring]]## or ##[[KeyPgZstring|Zstring]]##, the length of the string in characters will be returned. If the expression is of a user defined type, an ##[[KeyPgOperator|Operator]] **Len**## compatible with that data type is called. Otherwise, the size of the ##//expression//##'s data type in bytes is returned.
In the second form, if ##//expression//## is ##[[KeyPgZstring|Zstring]]## or ##[[KeyPgWstring|Wstring]]##, the size in bytes of an ASCII or Unicode character is returned, respectively. If ##//datatype//## is ##[[KeyPgString|String]]##, the size of the string descriptor type is returned.
The ##**Len**## unary ##[[KeyPgOperator|operator]]## can be overloaded with user defined types.
- ##**Len**## only allows expressions in the //[[CompilerOptlang|-lang qb]]// dialect.
- Can be used with built-in types and user-defined types in the //[[CompilerOptlang|-lang fb]]// and //[[CompilerOptlang|-lang fblite]]// dialects.
- Can be used with built-in types and user-defined types in the //[[CompilerOptlang|-lang fb]]// and //[[CompilerOptlang|-lang fblite]]// dialects.
- None in the //[[CompilerOptlang|-lang qb]]// dialect.
- ##[[KeyPgSizeof|Sizeof]]##
Deletions:
[[KeyPgDeclare declare]] [[KeyPgFunction function]] **Len** ( [[KeyPgByref byref]] //expression// [[KeyPgAs as]] [[KeyPgString string]] ) [[KeyPgAs as]] [[KeyPgInteger integer]]
[[KeyPgDeclare declare]] [[KeyPgFunction function]] **Len** ( [[KeyPgByref byref]] //expression// [[KeyPgAs as]] [[KeyPgZString zstring]] ) [[KeyPgAs as]] [[KeyPgInteger integer]]
[[KeyPgDeclare declare]] [[KeyPgFunction function]] **Len** ( [[KeyPgByref byref]] //expression// [[KeyPgAs as]] [[KeyPgWstring wstring]] ) [[KeyPgAs as]] [[KeyPgInteger integer]]
[[KeyPgDeclare declare]] [[KeyPgOperator operator]] **Len** ( [[KeyPgByref byref]] //expression// [[KeyPgAs as]] [[DataType datatype]] ) [[KeyPgAs as]] [[DataType datatype]]
[[KeyPgDeclare declare]] [[KeyPgFunction function]] **Len** ( //datatype// ) [[KeyPgAs as]] [[KeyPgInteger integer]]
//result// = **Len**( [[DataType DataType]] )
A [[DataType DataType]].
Returns the size of an expression or [[DataType DataType]] in bytes.
##**Len**## returns the length of an expression or the size of a [[DataType DataType]], in bytes.
In the first form, if ##//expression//## is of type ##[[KeyPgString String]]##, ##[[KeyPgWstring Wstring]]## or ##[[KeyPgZstring Zstring]]##, the length of the string in characters will be returned. If the expression is of a user defined type, an ##[[KeyPgOperator Operator]] **Len**## compatible with that data type is called. Otherwise, the size of the ##//expression//##'s data type in bytes is returned.
In the second form, if ##//expression//## is ##[[KeyPgZstring Zstring]]## or ##[[KeyPgWstring Wstring]]##, the size in bytes of an ASCII or Unicode character is returned, respectively. If ##//datatype//## is ##[[KeyPgString String]]##, the size of the string descriptor type is returned.
The ##**Len**## unary ##[[KeyPgOperator operator]]## can be overloaded with user defined types.
- ##**Len**## only allows expressions in the //[[CompilerOptlang -lang qb]]// dialect.
- Can be used with built-in types and user-defined types in the //[[CompilerOptlang -lang fb]]// and //[[CompilerOptlang -lang fblite]]// dialects.
- Can be used with built-in types and user-defined types in the //[[CompilerOptlang -lang fb]]// and //[[CompilerOptlang -lang fblite]]// dialects.
- None in the //[[CompilerOptlang -lang qb]]// dialect.
- ##[[KeyPgSizeof Sizeof]]##


Revision [17105]

Edited on 2014-06-25 12:31:44 by CountingPine [Add overloads, minor fixups]
Additions:
[[KeyPgDeclare declare]] [[KeyPgFunction function]] **Len** ( [[KeyPgByref byref]] //expression// [[KeyPgAs as]] [[KeyPgString string]] ) [[KeyPgAs as]] [[KeyPgInteger integer]]
[[KeyPgDeclare declare]] [[KeyPgFunction function]] **Len** ( [[KeyPgByref byref]] //expression// [[KeyPgAs as]] [[KeyPgZString zstring]] ) [[KeyPgAs as]] [[KeyPgInteger integer]]
[[KeyPgDeclare declare]] [[KeyPgFunction function]] **Len** ( [[KeyPgByref byref]] //expression// [[KeyPgAs as]] [[KeyPgWstring wstring]] ) [[KeyPgAs as]] [[KeyPgInteger integer]]

[[KeyPgDeclare declare]] [[KeyPgOperator operator]] **Len** ( [[KeyPgByref byref]] //expression// [[KeyPgAs as]] [[DataType datatype]] ) [[KeyPgAs as]] [[DataType datatype]]
In the first form, if ##//expression//## is of type ##[[KeyPgString String]]##, ##[[KeyPgWstring Wstring]]## or ##[[KeyPgZstring Zstring]]##, the length of the string in characters will be returned. If the expression is of a user defined type, an ##[[KeyPgOperator Operator]] **Len**## compatible with that data type is called. Otherwise, the size of the ##//expression//##'s data type in bytes is returned.
Deletions:
[[KeyPgDeclare declare]] [[KeyPgFunction function]] **Len** ( [[KeyPgByref byref]] //expression// [[KeyPgAs as]] [[KeyPgAny any]] ) [[KeyPgAs as]] [[KeyPgInteger integer]]
In the first form, if ##//expression//## is of type ##[[KeyPgString String]]##, ##[[KeyPgWstring Wstring]]## or ##[[KeyPgZstring Zstring]]##, the length of the string in characters will be returned. Otherwise an ##[[KeyPgOperator Operator]] **Len**## compatible with that data type is called. Otherwise, the size of the ##//expression//##'s data type in bytes is returned.


Revision [17103]

Edited on 2014-06-25 12:26:07 by CountingPine [Talk about Operator Len, minor fixups]
Additions:
Returns the length of an expression or data type
[[KeyPgDeclare declare]] [[KeyPgFunction function]] **Len** ( [[KeyPgByref byref]] //expression// [[KeyPgAs as]] [[KeyPgAny any]] ) [[KeyPgAs as]] [[KeyPgInteger integer]]
//result// = **Len**( //expression// )
##//expression//##
An expression of any type.
Returns the size of an expression or [[DataType DataType]] in bytes.
##**Len**## returns the length of an expression or the size of a [[DataType DataType]], in bytes.
In the first form, if ##//expression//## is of type ##[[KeyPgString String]]##, ##[[KeyPgWstring Wstring]]## or ##[[KeyPgZstring Zstring]]##, the length of the string in characters will be returned. Otherwise an ##[[KeyPgOperator Operator]] **Len**## compatible with that data type is called. Otherwise, the size of the ##//expression//##'s data type in bytes is returned.
In the second form, if ##//expression//## is ##[[KeyPgZstring Zstring]]## or ##[[KeyPgWstring Wstring]]##, the size in bytes of an ASCII or Unicode character is returned, respectively. If ##//datatype//## is ##[[KeyPgString String]]##, the size of the string descriptor type is returned.
If there is both a user defined type and a variable visible with the same name in the current scope, the user defined type takes precedence over the variable. To ensure that the ##**Len**## takes the variable instead of the user defined type, wrap the argument to ##**Len**## with parentheses to force it to be seen as an expression. For example ##Len((variable))##.
The ##**Len**## unary ##[[KeyPgOperator operator]]## can be overloaded with user defined types.
Deletions:
Returns the length of a variable or data type
[[KeyPgDeclare declare]] [[KeyPgFunction function]] **Len** ( [[KeyPgByref byref]] //variable// [[KeyPgAs as]] [[KeyPgAny any]] ) [[KeyPgAs as]] [[KeyPgInteger integer]]
//result// = **Len**( //variable// )
##//variable//##
A variable of any type.
Returns the size of a variable or [[DataType DataType]] in bytes.
##**Len**## returns the length of a variable or [[DataType DataType]], in bytes.
In the first form, if ##//variable//## is of type ##[[KeyPgString String]]##, ##[[KeyPgWstring Wstring]]## or ##[[KeyPgZstring Zstring]]##, the length of the string in characters will be returned. Otherwise, the size of ##//variable//##'s type in bytes is returned.
In the second form, if ##//datatype//## is ##[[KeyPgZstring Zstring]]## or ##[[KeyPgWstring Wstring]]##, the size of an ASCII or Unicode character is returned, respectively. If ##//datatype//## is ##[[KeyPgString String]]##, the size of the string descriptor type is returned.
If there is both a user defined type and a variable both having the same name in the same scope, the user defined type takes precedence over the variable. To ensure that the ##**Len**## takes the variable instead of the user defined type, wrap the argument to ##**Len**## with parentheses to force it to be seen as an expression. For example ##Len((variable))##.


Revision [13603]

Edited on 2008-07-21 18:48:19 by JeffMarshall [spelling]
Additions:
If there is both a user defined type and a variable both having the same name in the same scope, the user defined type takes precedence over the variable. To ensure that the ##**Len**## takes the variable instead of the user defined type, wrap the argument to ##**Len**## with parentheses to force it to be seen as an expression. For example ##Len((variable))##.
Deletions:
If there is both a user defined type and a variable both having the same name in the same scope, the user defined type takes precedence over the variable. To ensure that the ##**Len**## takes the variable instead of the user defined type, wrap the argument to ##**Len**## with parantheses to force it to be seen as an expression. For example ##Len((variable))##.


Revision [13445]

The oldest known version of this page was created on 2008-06-08 08:25:48 by JeffMarshall [spelling]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki



sf.net phatcode