Difference between revisions of "MC-Basic:LEFT$"
| Line 1: | Line 1: | ||
| + | {{MC-Basic | ||
| + | |SHORT FORM= | ||
| − | |||
| − | + | |SYNTAX= | |
| + | LEFT$(''<string>, <expression>'') | ||
| − | + | |AVAILABILITY= | |
| + | All versions | ||
| − | + | |DESCRIPTION= | |
| + | The LEFT$ returns the specified number of characters from the left-hand side of the string. | ||
| − | + | In UTF-8 supporting versions 4.5.1 and higher NULL characters are no longer cut | |
| − | + | out from strings, resulting in a different behavior: | |
| − | + | Len of Chr$(0) is 1: | |
| − | + | In former versions NULL characters could not appear in the middle of strings, | |
| − | + | since theconcationation process cut these characters from the resulting string. | |
| − | <''return value''>: String<br | + | |TYPE= |
| + | <''return value''>: String<br> | ||
| + | ''<string>'': String<br> | ||
| + | <''expression''>: Long | ||
| − | = | + | |RANGE= |
| + | <''return value''>: String<br> | ||
| + | ''<string>'': String<br> | ||
| + | <''expression''>: 0 to MaxLong | ||
| − | + | |UNITS= | |
| − | |||
| − | + | |DEFAULT= | |
| − | |||
| − | + | |SCOPE= | |
| − | + | Configuration, Task or Terminal | |
| − | |||
| − | + | |LIMITATIONS= | |
| + | Read only | ||
| − | --> | + | |EXAMPLE= |
| + | -->Test=”This string is too long”<br> | ||
| − | + | -->PRINT LEFT$(Test,4)<br> | |
| + | This | ||
| − | [[MC-Basic:MID$|MC-Basic: | + | |SEE ALSO= |
| + | * [[MC-Basic:MID$|MID$]] | ||
| + | * [[MC-Basic:RIGHT$|RIGHT$]] | ||
| − | [[MC-Basic: | + | [[Category:MC-Basic:String Manipulation|LEFT$]] |
| + | }} | ||
Latest revision as of 02:54, 23 January 2026
The LEFT$ returns the specified number of characters from the left-hand side of the string.
In UTF-8 supporting versions 4.5.1 and higher NULL characters are no longer cut
out from strings, resulting in a different behavior:
Len of Chr$(0) is 1:
In former versions NULL characters could not appear in the middle of strings,
since theconcationation process cut these characters from the resulting string.
Syntax
LEFT$(<string>, <expression>)
Availability
All versions
Type
<return value>: String
<string>: String
<expression>: Long
Range
<return value>: String
<string>: String
<expression>: 0 to MaxLong
Scope
Configuration, Task or Terminal
Limitations
Read only
Examples
-->Test=”This string is too long”
-->PRINT LEFT$(Test,4)
This