Extracts a portion of the text (also known as substring or Mid$).
numero = 251[getchars start=14&end=18]Hello there, Edwina[/getchars]The example above returns "Edwin," which is the sequence of letters starting at the 14th position and extending to the 18th position. Extracting sub-portions of text is useful when you need to get text from within files.
[getchars start=1&end=2&from=end]Hello there, Edwina[/getchars]The example above returns "na," which is the sequence of letters starting at the 1st position from the end and extending to the 2nd position from the end.The following parameters are optional to the [getchars] context:
Parameter | Description |
---|---|
start | Index placement of the first character to return. |
end | (Optional) The index placement of the last character to return. If no end is specified, all of the text up to the end of the string is returned. |
from | (Optional) Set to "end" to get characters from the ending of the string instead of the beginning. |
Trim | (Optional) To remove leading and trailing white space in a given text string. |
[getchars start=1&end=2][field1][/getchars]Example 2:
[getchars start=14&end=18]Hello there, Edwina[/getchars]Example 2 returns “Edwin”, which is the sequence of letters starting at the 14th position and extending to the 18th position. Extracting sub-portions of text is useful when you need to get text from files.Example 3:
[getchars start=1&end=2&from=end]Hello there, Edwina[/getchars]Example 3 returns “na”, which is the sequence of letters starting at the 1st position from the end and extending to the 2nd position from the end.You can use the new 'TRIM=Right/Left/Both' parameter for the [GetChars] context to remove leading and trailing white space in a given text string. Example WebDNA:
[text]test_string=This is a test. [/text]Example input string: "[test_string]"Remove leading white space:-[getchars start=1&end=&trim=left][test_string][/getchars]-Remove trailing white space:-[getchars start=1&end=&trim=right][test_string][/getchars]-Remove leading and trailing white space:-[getchars start=1&end=&trim=both][test_string][/getchars]-Remove leading and trailing white space, and retrieve characters in the 1-4 positions:-[getchars start=1&end=4&trim=both][test_string][/getchars]-Remove leading and trailing white space, and retrieve characters in the 1-5 positions, from the end:-[getchars start=1&end=5&trim=both&from=end][test_string][/getchars]-Results...Example input string: "This is a test. "Remove leading white space:-This is a test. -Remove trailing white space:-This is a test.-Remove leading and trailing white space:-This is a test.-Remove leading and trailing white space, and retrieve characters in the 1-4 positions:-This-Remove leading and trailing white space, and retrieve characters in the 1-5 positions, from the end:-test.-
Note that you still need to supply the 'start' and 'end' parameters
[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
[getchars start=x&end=y]Any Text[/getchars][getchars start=14&end=18]Hello there, Edwina[/getchars]
[getchars start=1&end=2&from=end]Hello there, Edwina[/getchars]
Parameter | Description |
---|---|
start | Index placement of the first character to return. |
end | (Optional) The index placement of the last character to return. If no end is specified, all of the text up to the end of the string is returned. |
from | (Optional) Set to "end" to get characters from the ending of the string instead of the beginning. |
Trim | (Optional) To remove leading and trailing white space in a given text string. |
[getchars start=1&end=2][field1][/getchars]
[getchars start=14&end=18]Hello there, Edwina[/getchars]
[getchars start=1&end=2&from=end]Hello there, Edwina[/getchars]
[text]test_string=
This is a test.
[/text]
Example input string: "[test_string]"
Remove leading white space:
-[getchars start=1&end=&trim=left][test_string][/getchars]-
Remove trailing white space:
-[getchars start=1&end=&trim=right][test_string][/getchars]-
Remove leading and trailing white space:
-[getchars start=1&end=&trim=both][test_string][/getchars]-
Remove leading and trailing white space, and retrieve characters in the 1-4 positions:
-[getchars start=1&end=4&trim=both][test_string][/getchars]-
Remove leading and trailing white space, and retrieve characters in the 1-5 positions, from the end:
-[getchars start=1&end=5&trim=both&from=end][test_string][/getchars]-
Note that you still need to supply the 'start' and 'end' parameters
[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!
A list of user-submitted tips ...
WebDNA LibrariesA list of available libraries for WebDNA...
AWS Raw WebDNA LAMP-Plus WebServerAmazon Web Services (AWS) README for Machine Image ID...
WebDNA ModulesA list of the currently available modules...
Technical Change HistoryThis Technical Change History provides a reverse chronological list of WebDNA changes...
F.A.QA compilation of some user's questions...
WebDNA provides a few options for password protecting your pages...
[replace]Replaces each found record in a database with the new field values...
[platform]...
[findstring][FindString Source=...
[xslt]The [xslt] Context allows the WebDNA programmer to 'apply' an XSL style sheet to an XML document and thus 'transform' the XML data into any format the programmer desires (usually HTML)...
[addfields][addfields db=...