library to format text in different fonts or cases plus a sort function.
🔸 Credits and Usage
This library is inspired by the work of three authors (in chronological order of publication date):
🔹 Fonts
Besides extra added font options, the toFont(fromText, font) method uses a different technique. On the first runtime bar (whether it is barstate.isfirst, barstate.islast, or between) regular letters and numbers and mapped with the chosen font. After this, each character is replaced using the build-in key - value pair map function.
Also an enum Efont is included.
Note: Some fonts are not complete, for example there isn't a replacement for every character in Superscript/Subscript.
Example of usage (besides the included table example):
🔹 Cases
The script includes a toCase(fromText, case) method to transform text into snake_case, UPPER SNAKE_CASE, kebab-case, camelCase or PascalCase, as well as an enum Ecase.
Example of usage (besides the included table example):
🔹 Sort
The sort(strings, order, sortByUnicodeDecimalNumbers) method returns a sorted array of strings.
- strings: array of strings, for example
Pine Script® words = array.from("Aword", "beyond", "Space", "salt", "pepper", "swing", "someThing", "otherThing", "12345", "_firstWord") - order: "asc" / "desc" (ascending / descending)
- sortByUnicodeDecimalNumbers: true/false; default = false
_____
• sortByUnicodeDecimalNumbers: every Unicode character is linked to a Unicode Decimal number (wikipedia.org/wiki/List_of_Unicode_characters), for example:
1 49
2 50
3 51
...
A 65
B 66
...
S 83
...
_ 95
` 96
a 97
b 98
...
o 111
p 112
q 113
r 114
s 115
...
This means, if we sort without adjusting (sortByUnicodeDecimalNumbers = true), in ascending order, the letter b (98 - small) would be after S (83 - Capital).
By disabling sortByUnicodeDecimalNumbers, Capital letters are intermediate transformed to str.lower() after which the Unicode Decimal number is retrieved from the small number instead of the capital number. For example S (83) -> s (115), after which the number 115 is used to sort instead of 83.
Example of usage (besides the included table example):
🔸 Methods/functions
method toFont(fromText, font)
toFont : Transforms text into the selected font
Namespace types: series string, simple string, input string, const string
Parameters:
fromText (string)
font (string)
Returns: `fromText` transformed to desired `font`
method toCase(fromText, case)
toCase : formats text to snake_case, UPPER SNAKE_CASE, kebab-case, camelCase or PascalCase
Namespace types: series string, simple string, input string, const string
Parameters:
fromText (string)
case (string)
Returns: `fromText` formatted to desired `case`
method sort(strings, order, sortByUnicodeDecimalNumbers)
sort : sorts an array of strings, ascending/descending and by Unicode Decimal numbers or not.
Namespace types: array<string>
Parameters:
strings (array<string>)
order (string)
sortByUnicodeDecimalNumbers (bool)
Returns: Sorted array of strings
Biblioteca Pine
Siguiendo fielmente el espíritu de TradingView, el autor ha publicado este código Pine como una biblioteca de código, permitiendo que otros programadores de Pine en nuestra comunidad puedan volver a utilizarlo. ¡Un brindis por el autor! Puede utilizar esta biblioteca de forma privada o en otras publicaciones de código abierto, pero tenga en cuenta que la reutilización de este código en publicaciones se rige por las Normas internas.
tradingview.com/chart/SSP/yW5eOqtm-Who-are-PineCoders/
TG Pine Script® Q&A: t.me/PineCodersQA
- We cannot control our emotions,
but we can control our keyboard -
Exención de responsabilidad
Biblioteca Pine
Siguiendo fielmente el espíritu de TradingView, el autor ha publicado este código Pine como una biblioteca de código, permitiendo que otros programadores de Pine en nuestra comunidad puedan volver a utilizarlo. ¡Un brindis por el autor! Puede utilizar esta biblioteca de forma privada o en otras publicaciones de código abierto, pero tenga en cuenta que la reutilización de este código en publicaciones se rige por las Normas internas.
tradingview.com/chart/SSP/yW5eOqtm-Who-are-PineCoders/
TG Pine Script® Q&A: t.me/PineCodersQA
- We cannot control our emotions,
but we can control our keyboard -