From WikiChip
Difference between revisions of "mirc/identifiers/$left"
< mirc‎ | identifiers

m (bot: correcting title)
m (Put back the identifier list.)
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{mirc title|$left Identifier}}{{mIRC Guide}}
+
{{mirc title|$left Identifier}}'''$left''' is a {{mIRC|string manipulation}} identifier used to return characters from the left side of a string.
'''$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. It cannot be 0.
+
<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 characters in the string minus <length> on the right.
+
If the length provided is negative, $left will return the string except the rightmost <length> characters.
  
<syntaxhighlight lang="mirc">$left(abcdefg, -3)
+
<syntaxhighlight lang="mirc">$left(abcdefg, -2)
 
; abcde</syntaxhighlight>
 
; abcde</syntaxhighlight>
  
Line 27: Line 25:
 
; [AB]</syntaxhighlight>
 
; [AB]</syntaxhighlight>
  
 
+
== See also ==
== See Also ==
 
 
* {{mIRC|string manipulation}}
 
* {{mIRC|string manipulation}}
 
* {{mIRC|$right}}
 
* {{mIRC|$right}}
 
* {{mIRC|$mid}}
 
* {{mIRC|$mid}}
 +
* {{mIRC|$pos}}
  
 +
{{mIRC identifier list}}
  
 
+
[[Category:mIRC identifiers|left]]
[[Category:MIRC identifiers]]
 

Latest revision as of 15:09, 22 September 2022

$left is a string manipulation identifier used to return characters from the left side of a string.

Synopsis[edit]

$left(<string>, <length>)

Parameters[edit]

<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[edit]

$left(appleseed, -4)
; apple
$left([AB]BotName, 4)
; [AB]

See also[edit]


[Expand]
v · d · e mIRC identifier list