From WikiChip
Difference between revisions of "mirc/identifiers/$left"
m |
Maroonbells (talk | contribs) m (Fixed example) |
||
Line 1: | Line 1: | ||
{{mirc title|$left Identifier}}'''$left''' is a {{mIRC|string manipulation}} identifier used to return characters from the left side of a string. | {{mirc title|$left Identifier}}'''$left''' is a {{mIRC|string manipulation}} identifier used to return characters from the left side of a string. | ||
− | |||
== Synopsis == | == Synopsis == | ||
Line 8: | Line 7: | ||
<span style="display: inline-block; width: 105px;">'''<string>'''</span>The string to manipulate | <span style="display: inline-block; width: 105px;">'''<string>'''</span>The string to manipulate | ||
− | <span style="display: inline-block; width: 105px;">'''<length>'''</span>The length or number of characters to remove from the original string. <length> can be a positive or negative. | + | <span style="display: inline-block; width: 105px;">'''<length>'''</span>The length or number of characters to remove from the original string. <length> can be a positive or negative. Using 0 returns $null (0 characters). |
− | |||
If the length provided is positive, $left will return the <length> characters from the left of the string. | If the length provided is positive, $left will return the <length> characters from the left of the string. | ||
Line 15: | Line 13: | ||
; abcd</syntaxhighlight> | ; abcd</syntaxhighlight> | ||
− | If the length provided is negative, $left will return the | + | If the length provided is negative, $left will return the string except the rightmost <length> characters. |
− | <syntaxhighlight lang="mirc">$left(abcdefg, - | + | <syntaxhighlight lang="mirc">$left(abcdefg, -2) |
; abcde</syntaxhighlight> | ; abcde</syntaxhighlight> | ||
Line 26: | Line 24: | ||
<syntaxhighlight lang="mirc">$left([AB]BotName, 4) | <syntaxhighlight lang="mirc">$left([AB]BotName, 4) | ||
; [AB]</syntaxhighlight> | ; [AB]</syntaxhighlight> | ||
− | |||
== See also == | == See also == | ||
Line 32: | Line 29: | ||
* {{mIRC|$right}} | * {{mIRC|$right}} | ||
* {{mIRC|$mid}} | * {{mIRC|$mid}} | ||
− | {{mIRC | + | * {{mIRC|$pos}} |
− | |||
− |
Revision as of 10:53, 22 September 2022
Commands & Identifiers
Basics
Events
Matching Tools
Data Storage
Control Structures
GUI Scripting
Sockets
Advanced Scripting
Additional Resources
Security
Other
$left is a string manipulation identifier used to return characters from the left side of a string.
Contents
Synopsis
$left(<string>, <length>)
Parameters
<string>The string to manipulate
<length>The length or number of characters to remove from the original string. <length> can be a positive or negative. Using 0 returns $null (0 characters).
If the length provided is positive, $left will return the <length> characters from the left of the string.
$left(abcdefg, 4) ; abcd
If the length provided is negative, $left will return the string except the rightmost <length> characters.
$left(abcdefg, -2) ; abcde
More Examples
$left(appleseed, -4) ; apple
$left([AB]BotName, 4) ; [AB]