- GETTING STARTED
- GUIDES
- COMMANDS
- Server connection
- File Transfer
- Directory operations
- File operations
- Script output
- Miscellaneous
- OTHER
TEXTCUT
Returns a part of a text value.
Syntax: TEXTCUT(text,start_position,length)
- text: Source text.
- start_position: The position of the first character in the text that is to be included in the returned text part.
- length: Number of characters to extract from the starting position.
Return value:
This command returns the specified part of the source text. On error it returns an empty text value.
Remarks:
- The start_position parameter is not zero-based. The first character is 1, the second 2 and so on.
- Use -1 as the length parameter to get the rest of the text from the start position.
- If length is higher than the rest of the available text from the start position the full remaining text will be returned.
See Also:
TEXTLENGTH
Command History:
Added in ScriptFTP 3.1 build October 1th 2008
Example:
# Prints -this-
$part=TEXTCUT("this is ScriptFTP",1,4)
PRINT($part)
# Prints -La Mancha-
$part=TEXTCUT("In a village of La Mancha",17,9)
PRINT($part)
# Prints nothing, the second
# parameter (11) is wrong.
$part=TEXTCUT("whatever",11,8)
PRINT($part)
# Prints -123456789.txt-
$filename="prefix123456789.txt"
$filename2=TEXTCUT($filename,7,-1)
PRINT($filename2)
# Prints -123456789-
$text1="123456789"
$text2=TEXTCUT($text1,1,999)
PRINT($text2)

