Technical References - [listchars]

Breaks a string of text into separate characters.

numero = 256
interpreted = N
texte = [listchars Chars]Some Text[/listchars] To display a list of all the separate characters in a string, use a [listchars] context. Example:
[listchars chars=WebDNA 6.0][index]: [char]
[/listchars]
The example above yields: 1: W 2: e 3: b 4: D 5: N 6: A 7: 8: 6 9: . 10: 0 The following parameters are used in the [listchars] context:
ParameterDescription
chars(Required) string of text to break up.
from(Optional) Sets the direction the 'chars' string is parsed. Default is 'START'. If set to 'END' , characters will be listed starting from the end of the 'chars' string, to the beginning.
start(Optional) Sets the start posotion, in the 'chars' string, from which to list the characters. If not specified, characters will be listed starting from the first position in the string. If the 'From' parameter is set to 'END', the 'start' position is relative to the end of the 'chars' string.
end(Optional) Sets the end posotion, in the 'chars' string, from which to stop listing the characters. If not specified, characters will be listed starting from the 'start' position, and up to the last position in the string. If the 'From' parameter is set to 'END', the 'last' position is relative to the end of the 'chars' string.
The following tags are available inside a [listchars] context:
TagDescription
[index]A number from 1 to the total number of chars in the text indicating the iteration index.
[char] The current character of the 'chars' string being iterated.
[position]The current character position. The position is '1' based, and is relative to the start of the 'chars' string, unless the from parameters is set to 'END', in which case 'position' is relative to the end of the 'chars' string.
[break]From version 8.1, if the [listchars] context sees the [break] tag while executing a loop, it will stop looping, once it finishes the current loop. Thus the [break] tag should only appear in a [showif] statement that is evaluated at the end (bottom) of the loop.
Example 2
[listchars chars=1234567890.abcdefg&start=4&end=10&from=end] Character at string position [position] = '[char]'[/listchars]
The example above yields: Character at string position 4 = 'd' Character at string position 5 = 'c' Character at string position 6 = 'b' Character at string position 7 = 'a' Character at string position 8 = '.' Character at string position 9 = '0' Character at string position 10 = '9

This contest is more powerful than it looks; you can use it as a [loop] and introduce other contexts in it. See the example below

[listchars chars=abcdefg&start=1&end=7][append db=base.db]ref=[position]&character=[char][/append][/listchars]

[getchars] or [listchars] have never been multi-byte capable. The code assumes every character is a single byte. We produce a multi-byte capable version of [listchars] and [getchars]. They are named differently, [mblistchars] and [mbgetchars]. This way they don't mess up existing sites that aren't expecting them to be used on UTF-8

[listchars Chars]Some Text[/listchars]

To display a list of all the separate characters in a string, use a [listchars] context.

Example:
[listchars chars=WebDNA 6.0]
[index]: [char]

[/listchars]

The example above yields:

1: W
2: e
3: b
4: D
5: N
6: A
7:
8: 6
9: .
10: 0
The following parameters are used in the [listchars] context:

ParameterDescription
chars(Required) string of text to break up.
from(Optional) Sets the direction the 'chars' string is parsed. Default is 'START'. If set to 'END' , characters will be listed starting from the end of the 'chars' string, to the beginning.
start(Optional) Sets the start posotion, in the 'chars' string, from which to list the characters. If not specified, characters will be listed starting from the first position in the string. If the 'From' parameter is set to 'END', the 'start' position is relative to the end of the 'chars' string.
end(Optional) Sets the end posotion, in the 'chars' string, from which to stop listing the characters. If not specified, characters will be listed starting from the 'start' position, and up to the last position in the string. If the 'From' parameter is set to 'END', the 'last' position is relative to the end of the 'chars' string.


The following tags are available inside a [listchars] context:

TagDescription
[index]A number from 1 to the total number of chars in the text indicating the iteration index.
[char] The current character of the 'chars' string being iterated.
[position]The current character position. The position is '1' based, and is relative to the start of the 'chars' string, unless the from parameters is set to 'END', in which case 'position' is relative to the end of the 'chars' string.
[break]From version 8.1, if the [listchars] context sees the [break] tag while executing a loop, it will stop looping, once it finishes the current loop. Thus the [break] tag should only appear in a [showif] statement that is evaluated at the end (bottom) of the loop.


Example 2
[listchars chars=1234567890.abcdefg&start=4&end=10&from=end] Character at string position [position] = '[char]'
[/listchars]

The example above yields:

Character at string position 4 = 'd'
Character at string position 5 = 'c'
Character at string position 6 = 'b'
Character at string position 7 = 'a'
Character at string position 8 = '.'
Character at string position 9 = '0'
Character at string position 10 = '9

This contest is more powerful than it looks; you can use it as a [loop] and introduce other contexts in it. See the example below


[listchars chars=abcdefg&start=1&end=7]
[append db=base.db]ref=[position]&character=[char][/append]
[/listchars]


[getchars] or [listchars] have never been multi-byte capable. The code assumes every character is a single byte. We produce a multi-byte capable version of [listchars] and [getchars]. They are named differently, [mblistchars] and [mbgetchars]. This way they don't mess up existing sites that aren't expecting them to be used on UTF-8



DOWNLOAD WEBDNA NOW!

Top Articles:

WebDNA Libraries

A list of available libraries for WebDNA...

Download WebDNA Applications

WebDNA applications...

F.A.Q

A compilation of some user's questions...

WebDNA Modules

A list of the currently available modules...

Tips and Tricks

A list of user-submitted tips ...

[biotype]

BioType is a behavioral biometrics WebDNA function based on ADGS research and development (from version 8...

Related Readings:

[founditems]

[founditems]...

[formvariables]

Lists all the form variables and parameters passed to the current page...

[SQL]

Performs a SQL statement on an ODBC data source...

[listchars]

Breaks a string of text into separate characters...

[copyfile]

Copy a file with the content you want on your webspace...

[ddesend]

Sends text to a DDE server program on the local machine...