Difference between revisions of "$qt"
From Scriptwiki
m |
m (Added note about imbalanced ") |
||
Line 1: | Line 1: | ||
− | |||
Adds or removes outer enclosing quotes around text. Particularly useful for specifying file names or paths with spaces. | Adds or removes outer enclosing quotes around text. Particularly useful for specifying file names or paths with spaces. | ||
+ | $qt(<text>) | ||
+ | $noqt(<text>) | ||
== Example == | == Example == | ||
$qt(My text.) returns ''"My text."'' | $qt(My text.) returns ''"My text."'' | ||
+ | $qt("My text.") returns ''"My text."'' | ||
+ | $noqt(My Text.) returns ''My text.'' | ||
$noqt("This is some "text"") returns ''This is some "text"'' | $noqt("This is some "text"") returns ''This is some "text"'' | ||
+ | |||
+ | == Note == | ||
+ | Essentially these identifers check to see if the first and last character is a quote and adds or removes as needed. | ||
+ | This means imbalanced strings would return as follows: | ||
+ | $qt("Text) returns "Text" | ||
+ | $qt(Text") returns "Text" | ||
+ | $noqt("Text) returns Text | ||
+ | $noqt(Text") returns Text | ||
+ | There is no checks for matching quotes. | ||
[[Category:Text and Number Identifiers]] | [[Category:Text and Number Identifiers]] |
Latest revision as of 11:00, 6 April 2008
Adds or removes outer enclosing quotes around text. Particularly useful for specifying file names or paths with spaces.
$qt(<text>) $noqt(<text>)
Example
$qt(My text.) returns "My text." $qt("My text.") returns "My text." $noqt(My Text.) returns My text. $noqt("This is some "text"") returns This is some "text"
Note
Essentially these identifers check to see if the first and last character is a quote and adds or removes as needed. This means imbalanced strings would return as follows:
$qt("Text) returns "Text" $qt(Text") returns "Text" $noqt("Text) returns Text $noqt(Text") returns Text
There is no checks for matching quotes.