Excerpt | ||
---|---|---|
| ||
substringbyteLength(string, startPosition, endPosition) Returns a portion of the supplied string between specified character positionsencoding) Return the length in bytes of a string, optionally using a given encoding. |
Function:
...
byteLength()
Returns a portion of the supplied string between specified character positionsReturn the length in bytes of a string, optionally using a given encoding. Allowed encodings include UTF-8, UTF-16, ASCII, CP1252 and ISO-8859-1.
Syntax
substringbyteLength(string, startPosition, endPositionencoding)
Argument | Type | Description |
---|---|---|
string | String | The string to be processed. |
encoding |
String | The character |
encoding to use. |
Examples
substring("01223236023",6,9)
Returns the portion of the string between character positions 6 and 9: "2360".
substring("01223236023",6)
Returns the portion of the string between character position 6 and the end of the string: "236023".
substring(in.fileName, indexOf(in.fileName, "_")+1, indexOf(in.fileName, "_")+9)
Suppose in.fileName contained file names with the format "switchRC48_20060708.exp" and we wish to retrieve the date from the file name.
The first, string portion of the file name is variable so we search for the "_" character with the function indexOf, and use the returned value in substring to pull out the date from the file name.
See Also
...
byteLength('ab\u1e09', 'UTF-8')
Returns 5, which is the length of the string in bytes when using the UTF-8 encoding.
byteLength('ab\u1e09', 'UTF-8')
This expression also returns 5, as the default encoding is UTF-8.