Skip to main content

spreadsheet_ods_formula/generated/
text.rs

1
2use crate::*;
3#[allow(unused_imports)]
4use crate::text::*;
5
6/// Converts full-width to half-width ASCII and katakana characters.
7///
8/// [documentfoundation->ASC](https://wiki.documentfoundation.org/Documentation/Calc_Functions/ASC)
9///
10/// __Syntax__: 
11/// ```ods
12///     ASC( T: Text )
13/// ```
14///
15/// __Constraints__:
16/// None
17///
18/// __Semantics__:
19/// Conversion is done for full-width ASCII and UNICODE katakana characters, 
20/// some characters are converted in a special way, see table below. Other 
21/// characters are copied from T to the result. This is the complementary 
22/// function to JIS.
23/// 
24/// The percent sign % in the conversion table below denotes the modulo 
25/// operation. A followed by means that a character is converted to two 
26/// consecutive characters.
27/// 
28/// Note 1: The "\" (REVERSE SOLIDUS, U+005C) is a specialty that gets 
29/// displayed as a Yen sign with some Japanese fonts, which is a legacy of 
30/// code-page 932.
31/// 
32/// Note 2: For references regarding halfwidth and fullwidth characters see 
33/// UAX11 and the Halfwidth and Fullwidth Code Chart of UNICODE.
34/// 
35/// Note 3: For information about the mapping of JIS X 0201 and JIS X 0208 to 
36/// Unicode characters see JISX0201 and JISX0208.
37///
38/// __See also__: [crate::of::jis()], 
39#[inline]
40pub fn asc<A: Text>(t: A) -> FnText1<A> {
41    FnText1("ASC", t)
42}
43
44/// Return character represented by the given numeric value
45///
46/// [documentfoundation->CHAR](https://wiki.documentfoundation.org/Documentation/Calc_Functions/CHAR)
47///
48/// __Syntax__: 
49/// ```ods
50///     CHAR( N: Number )
51/// ```
52///
53/// __Constraints__:
54/// N ≤ 127; Evaluators may evaluate expressions where N ≥ 1, N ≤ 255.
55///
56/// __Semantics__:
57/// 
58/// Returns character represented by the given numeric value.
59/// 
60/// Evaluators should return an Error if N > 255.
61/// 
62/// Evaluators should implement CHAR such that CODE(CHAR(N)) returns N for any 
63/// 1 ≤ N ≤ 255.
64/// 
65/// Note 1: Beyond 127, some evaluators return a character from a 
66/// system-specific code page, while others return the UNICODE character. Most 
67/// evaluators do not allow values greater than 255.
68/// 
69/// Note 2: Where interoperability is a concern, expressions should use the 
70/// UNICHAR function. 6.20.25
71///
72/// __See also__: [crate::of::code()], [crate::of::unichar()], [crate::of::unicode()], 
73#[inline]
74pub fn char<A: Number>(n: A) -> FnText1<A> {
75    FnText1("CHAR", n)
76}
77
78/// Remove all non-printable characters from the string and return the result.
79///
80/// [documentfoundation->CLEAN](https://wiki.documentfoundation.org/Documentation/Calc_Functions/CLEAN)
81///
82/// __Syntax__: 
83/// ```ods
84///     CLEAN( T: Text )
85/// ```
86///
87/// __Semantics__:
88/// 
89/// Removes all non-printable characters from the string T and returns the 
90/// resulting string. Evaluators should remove each particular character from 
91/// the string, if and only if the character belongs to UNICODE class Cc (Other 
92/// - Control), or to Unicode class Cn (Other - Not Assigned). The resulting 
93/// string shall contain all printable characters from the original string, in 
94/// the same order. The space character is considered a printable character.
95///
96/// __See also__: 
97#[inline]
98pub fn clean<A: Text>(t: A) -> FnText1<A> {
99    FnText1("CLEAN", t)
100}
101
102/// Return numeric value corresponding to the first character of the text 
103/// value.
104///
105/// [documentfoundation->CODE](https://wiki.documentfoundation.org/Documentation/Calc_Functions/CODE)
106///
107/// __Syntax__: 
108/// ```ods
109///     CODE( T: Text )
110/// ```
111///
112/// __Constraints__:
113/// code point ≤ 127. Evaluators may evaluate expressions where Length(T) > 
114/// 0.
115///
116/// __Semantics__:
117/// 
118/// Returns a numeric value which represents the first letter of the given text 
119/// T.
120/// 
121/// Behavior for code points ≥ 128 is implementation-defined. Evaluators may 
122/// use the underlying system's code page. Evaluators should implement CODE 
123/// such that CODE(CHAR(N)) returns N for 1 ≤ N ≤ 255.
124///
125/// __Note__:
126/// Where interoperability is a concern, expressions should use the UNICODE 
127/// function. 6.20.26
128///
129/// __See also__: [crate::of::char()], [crate::of::unichar()], [crate::of::unicode()], 
130#[inline]
131pub fn code<A: Text>(t: A) -> FnNumber1<A> {
132    FnNumber1("CODE", t)
133}
134
135/// Concatenate the text strings
136///
137/// [documentfoundation->CONCATENATE](https://wiki.documentfoundation.org/Documentation/Calc_Functions/CONCATENATE)
138///
139/// __Syntax__: 
140/// ```ods
141///     CONCATENATE({ T: Text}+ )
142/// ```
143///
144/// __Constraints__:
145/// None
146///
147/// __Semantics__:
148/// Concatenate each text value, in order, into a single text result.
149///
150/// __See also__: [crate::of::infix operator "&"()], 
151#[inline]
152pub fn concatenate<A: Sequence>(t: A) -> FnText1<A> {
153    FnText1("CONCATENATE", t)
154}
155
156/// Convert the parameters to Text formatted as currency.
157///
158/// [documentfoundation->DOLLAR](https://wiki.documentfoundation.org/Documentation/Calc_Functions/DOLLAR)
159///
160/// __Syntax__: 
161/// ```ods
162///     DOLLAR( N: Number )
163/// ```
164///
165/// __Constraints__:
166/// None
167///
168/// __Semantics__:
169/// Returns the value formatted as a currency, using locale-specific data. D is 
170/// the number of decimal places used in the result string, a negative D rounds 
171/// number N. If D is omitted, locale information may be used to determine the 
172/// currency's decimal places, or a value of 2 shall be assumed.
173///
174/// __See also__: [crate::of::dollar_()], 
175#[inline]
176pub fn dollar<A: Number>(n: A) -> FnText1<A> {
177    FnText1("DOLLAR", n)
178}
179
180/// Convert the parameters to Text formatted as currency.
181///
182/// [documentfoundation->DOLLAR](https://wiki.documentfoundation.org/Documentation/Calc_Functions/DOLLAR)
183///
184/// __Syntax__: 
185/// ```ods
186///     DOLLAR( N: Number; D: Integer )
187/// ```
188///
189/// __Constraints__:
190/// None
191///
192/// __Semantics__:
193/// Returns the value formatted as a currency, using locale-specific data. D is 
194/// the number of decimal places used in the result string, a negative D rounds 
195/// number N. If D is omitted, locale information may be used to determine the 
196/// currency's decimal places, or a value of 2 shall be assumed.
197///
198/// __See also__: [crate::of::dollar()], 
199#[inline]
200pub fn dollar_<A: Number, B: Number>(n: A, d: B) -> FnText2<A, B> {
201    FnText2("DOLLAR", n, d)
202}
203
204/// Report if two text values are equal using a case-sensitive comparison .
205///
206/// [documentfoundation->EXACT](https://wiki.documentfoundation.org/Documentation/Calc_Functions/EXACT)
207///
208/// __Syntax__: 
209/// ```ods
210///     EXACT( T1: Text; T2: Text )
211/// ```
212///
213/// __Constraints__:
214/// None
215///
216/// __Semantics__:
217/// Converts both sides to Text, and then returns TRUE if the two text values 
218/// are equal, including case, otherwise it returns FALSE.
219///
220/// __See also__: [crate::of::find()], [crate::of::search()], [crate::of::infix operator "<>"()], [crate::of::infix operator "="()], 
221#[inline]
222pub fn exact<A: Text, B: Text>(t1: A, t2: B) -> FnLogical2<A, B> {
223    FnLogical2("EXACT", t1, t2)
224}
225
226/// Return the starting position of a given text.
227///
228/// [documentfoundation->FIND](https://wiki.documentfoundation.org/Documentation/Calc_Functions/FIND)
229///
230/// __Syntax__: 
231/// ```ods
232///     FIND( Search: Text; T: Text )
233/// ```
234///
235/// __Constraints__:
236/// Start ≥ 1
237///
238/// __Semantics__:
239/// Returns the character position where Search is first found in T, when the 
240/// search is started from character position Start. The match is 
241/// case-sensitive, and no wildcards or other instructions are considered in 
242/// Search. Returns an Error if text not found.
243///
244/// __See also__: [crate::of::exact()], [crate::of::search()], [crate::of::find_()], 
245#[inline]
246pub fn find<A: Text, B: Text>(search: A, t: B) -> FnNumber2<A, B> {
247    FnNumber2("FIND", search, t)
248}
249
250/// Return the starting position of a given text.
251///
252/// [documentfoundation->FIND](https://wiki.documentfoundation.org/Documentation/Calc_Functions/FIND)
253///
254/// __Syntax__: 
255/// ```ods
256///     FIND( Search: Text; T: Text; Start: Integer )
257/// ```
258///
259/// __Constraints__:
260/// Start ≥ 1
261///
262/// __Semantics__:
263/// Returns the character position where Search is first found in T, when the 
264/// search is started from character position Start. The match is 
265/// case-sensitive, and no wildcards or other instructions are considered in 
266/// Search. Returns an Error if text not found.
267///
268/// __See also__: [crate::of::exact()], [crate::of::search()], [crate::of::find()], 
269#[inline]
270pub fn find_<A: Text, B: Text, C: Number>(search: A, t: B, start: C) -> FnNumber3<A, B, C> {
271    FnNumber3("FIND", search, t, start)
272}
273
274/// Round the number to a specified number of decimals and format the result as 
275/// a text.
276///
277/// [documentfoundation->FIXED](https://wiki.documentfoundation.org/Documentation/Calc_Functions/FIXED)
278///
279/// __Syntax__: 
280/// ```ods
281///     FIXED( N: Number )
282/// ```
283///
284/// __Constraints__:
285/// None
286///
287/// __Semantics__:
288/// Rounds value N to D decimal places (after the decimal point) and returns 
289/// the result formatted as text, using locale-specific settings. If D is 
290/// negative, the number is rounded to ABS(D) places to the left from the 
291/// decimal point. If the optional parameter OmitSeparators is TRUE, then group 
292/// separators are omitted from the resulting string. Group separators are 
293/// included in the absence of this parameter. If D is a fraction, it is 
294/// rounded towards 0 as an integer (ignoring what is the closest integer).
295///
296/// __See also__: [crate::of::abs()], [crate::of::fixed_()], [crate::of::fixed__()], 
297#[inline]
298pub fn fixed<A: Number>(n: A) -> FnText1<A> {
299    FnText1("FIXED", n)
300}
301
302/// Round the number to a specified number of decimals and format the result as 
303/// a text.
304///
305/// [documentfoundation->FIXED](https://wiki.documentfoundation.org/Documentation/Calc_Functions/FIXED)
306///
307/// __Syntax__: 
308/// ```ods
309///     FIXED( N: Number; D: Integer )
310/// ```
311///
312/// __Constraints__:
313/// None
314///
315/// __Semantics__:
316/// Rounds value N to D decimal places (after the decimal point) and returns 
317/// the result formatted as text, using locale-specific settings. If D is 
318/// negative, the number is rounded to ABS(D) places to the left from the 
319/// decimal point. If the optional parameter OmitSeparators is TRUE, then group 
320/// separators are omitted from the resulting string. Group separators are 
321/// included in the absence of this parameter. If D is a fraction, it is 
322/// rounded towards 0 as an integer (ignoring what is the closest integer).
323///
324/// __See also__: [crate::of::abs()], [crate::of::fixed()], [crate::of::fixed__()], 
325#[inline]
326pub fn fixed_<A: Number, B: Number>(n: A, d: B) -> FnText2<A, B> {
327    FnText2("FIXED", n, d)
328}
329
330/// Round the number to a specified number of decimals and format the result as 
331/// a text.
332///
333/// [documentfoundation->FIXED](https://wiki.documentfoundation.org/Documentation/Calc_Functions/FIXED)
334///
335/// __Syntax__: 
336/// ```ods
337///     FIXED( N: Number; D: Integer; OmitSeparators: Logical )
338/// ```
339///
340/// __Constraints__:
341/// None
342///
343/// __Semantics__:
344/// Rounds value N to D decimal places (after the decimal point) and returns 
345/// the result formatted as text, using locale-specific settings. If D is 
346/// negative, the number is rounded to ABS(D) places to the left from the 
347/// decimal point. If the optional parameter OmitSeparators is TRUE, then group 
348/// separators are omitted from the resulting string. Group separators are 
349/// included in the absence of this parameter. If D is a fraction, it is 
350/// rounded towards 0 as an integer (ignoring what is the closest integer).
351///
352/// __See also__: [crate::of::abs()], [crate::of::fixed()], [crate::of::fixed_()], 
353#[inline]
354pub fn fixed__<A: Number, B: Number, C: Logical>(n: A, d: B, omit_separators: C) -> FnText3<A, B, C> {
355    FnText3("FIXED", n, d, omit_separators)
356}
357
358/// Converts half-width to full-width ASCII and katakana characters.
359///
360/// [documentfoundation->JIS](https://wiki.documentfoundation.org/Documentation/Calc_Functions/JIS)
361///
362/// __Syntax__: 
363/// ```ods
364///     JIS( T: Text )
365/// ```
366///
367/// __Constraints__:
368/// None
369///
370/// __Semantics__:
371/// Conversion is done for half-width ASCII and UNICODE katakana characters, 
372/// some characters are converted in a special way, see table below. Other 
373/// characters are copied from T to the result. This is the complementary 
374/// function to ASC.
375/// 
376/// A followed by means that there are two consecutive characters to convert 
377/// from.
378/// 
379/// Note 1: For references regarding halfwidth and fullwidth characters see 
380/// UAX11 and the Halfwidth and Fullwidth Code Chart of UNICODE.
381/// 
382/// Note 2: For information about the mapping of JIS X 0201 and JIS X 0208 to 
383/// Unicode characters see JISX0201 and JISX0208.
384///
385/// __See also__: [crate::of::asc()], 
386#[inline]
387pub fn jis<A: Text>(t: A) -> FnText1<A> {
388    FnText1("JIS", t)
389}
390
391/// Return a selected number of text characters from the left.
392///
393/// [documentfoundation->LEFT](https://wiki.documentfoundation.org/Documentation/Calc_Functions/LEFT)
394///
395/// __Syntax__: 
396/// ```ods
397///     LEFT( T: Text )
398/// ```
399///
400/// __Constraints__:
401/// Length ≥ 0
402///
403/// __Semantics__:
404/// Returns the INT(Length) number of characters of text T, starting from the 
405/// left. If Length is omitted, it defaults to 1; otherwise, it computes Length 
406/// = INT(Length). If T has fewer than Length characters, it returns T. This 
407/// means that if T is an empty string (which has length 0) or the parameter 
408/// Length is 0, LEFT() will always return an empty string. Note that if Length 
409/// < 0, an Error is returned. This function shall return the same string as 
410/// MID(T; 1; Length).
411/// 
412/// The results of this function may be normalization-sensitive. 4.2
413///
414/// __See also__: [crate::of::int()], [crate::of::len()], [crate::of::mid()], [crate::of::right()], [crate::of::left_()], 
415#[inline]
416pub fn left<A: Text>(t: A) -> FnText1<A> {
417    FnText1("LEFT", t)
418}
419
420/// Return a selected number of text characters from the left.
421///
422/// [documentfoundation->LEFT](https://wiki.documentfoundation.org/Documentation/Calc_Functions/LEFT)
423///
424/// __Syntax__: 
425/// ```ods
426///     LEFT( T: Text; Length: Integer )
427/// ```
428///
429/// __Constraints__:
430/// Length ≥ 0
431///
432/// __Semantics__:
433/// Returns the INT(Length) number of characters of text T, starting from the 
434/// left. If Length is omitted, it defaults to 1; otherwise, it computes Length 
435/// = INT(Length). If T has fewer than Length characters, it returns T. This 
436/// means that if T is an empty string (which has length 0) or the parameter 
437/// Length is 0, LEFT() will always return an empty string. Note that if Length 
438/// < 0, an Error is returned. This function shall return the same string as 
439/// MID(T; 1; Length).
440/// 
441/// The results of this function may be normalization-sensitive. 4.2
442///
443/// __See also__: [crate::of::int()], [crate::of::len()], [crate::of::mid()], [crate::of::right()], [crate::of::left()], 
444#[inline]
445pub fn left_<A: Text, B: Number>(t: A, length: B) -> FnText2<A, B> {
446    FnText2("LEFT", t, length)
447}
448
449/// Return the length, in characters, of given text
450///
451/// [documentfoundation->LEN](https://wiki.documentfoundation.org/Documentation/Calc_Functions/LEN)
452///
453/// __Syntax__: 
454/// ```ods
455///     LEN( T: Text )
456/// ```
457///
458/// __Constraints__:
459/// None.
460///
461/// __Semantics__:
462/// Computes number of characters (not the number of bytes) in T. If T is of 
463/// type Number, it is automatically converted to Text, including a fractional 
464/// part and decimal separator if necessary.
465/// 
466/// The results of this function may be normalization-sensitive. 4.2
467///
468/// __See also__: [crate::of::text()], [crate::of::istext()], [crate::of::left()], [crate::of::mid()], [crate::of::right()], 
469#[inline]
470pub fn len<A: Text>(t: A) -> FnNumber1<A> {
471    FnNumber1("LEN", t)
472}
473
474/// Return input string, but with all uppercase letters converted to lowercase 
475/// letters.
476///
477/// [documentfoundation->LOWER](https://wiki.documentfoundation.org/Documentation/Calc_Functions/LOWER)
478///
479/// __Syntax__: 
480/// ```ods
481///     LOWER( T: Text )
482/// ```
483///
484/// __Constraints__:
485/// None
486///
487/// __Semantics__:
488/// Return input string, but with all uppercase letters converted to lowercase 
489/// letters, as defined by §3.13 Default Case Algorithms, §4.2 Case-Normative 
490/// and §5.18 Case Mappings of UNICODE. As with most functions, it is 
491/// side-effect free (it does not modify the source values). All Evaluators 
492/// shall convert A-Z to a-z.
493///
494/// __Note__:
495/// As this function can be locale aware, results may be unexpected in certain 
496/// cases. For example in a Turkish locale an upper case "I without dot" (LATIN 
497/// CAPITAL LETTER I, U+0049) is converted to a lower case "i without dot" 
498/// (LATIN SMALL LETTER DOTLESS I, U+0131).
499///
500/// __See also__: [crate::of::upper()], [crate::of::proper()], 
501#[inline]
502pub fn lower<A: Text>(t: A) -> FnText1<A> {
503    FnText1("LOWER", t)
504}
505
506/// Returns extracted text, given an original text, starting position, and 
507/// length.
508///
509/// [documentfoundation->MID](https://wiki.documentfoundation.org/Documentation/Calc_Functions/MID)
510///
511/// __Syntax__: 
512/// ```ods
513///     MID( T: Text; Start: Integer; Length: Integer )
514/// ```
515///
516/// __Constraints__:
517/// Start ≥ 1, Length ≥ 0.
518///
519/// __Semantics__:
520/// Returns the characters from T, starting at character position Start, for up 
521/// to Length characters. For the integer conversions, Start = INT(Start), and 
522/// Length = INT(Length). If there are less than Length characters starting at 
523/// start, it returns as many characters as it can beginning with Start. In 
524/// particular, if Start > LEN(T), it returns the empty string (""). If Start < 
525/// 0, it returns an Error. If Start ≥ 0, and Length = 0, it returns the 
526/// empty string. Note that MID(T;1;Length) produces the same results as 
527/// LEFT(T;Length).
528/// 
529/// The results of this function may be normalization-sensitive. 4.2
530///
531/// __See also__: [crate::of::int()], [crate::of::left()], [crate::of::len()], [crate::of::right()], [crate::of::replace()], [crate::of::substitute()], 
532#[inline]
533pub fn mid<A: Text, B: Number, C: Number>(t: A, start: B, length: C) -> FnText3<A, B, C> {
534    FnText3("MID", t, start, length)
535}
536
537/// Return the input string with the first letter of each word converted to an 
538/// uppercase letter and the rest of the letters in the word converted to 
539/// lowercase.
540///
541/// [documentfoundation->PROPER](https://wiki.documentfoundation.org/Documentation/Calc_Functions/PROPER)
542///
543/// __Syntax__: 
544/// ```ods
545///     PROPER( T: Text )
546/// ```
547///
548/// __Constraints__:
549/// None
550///
551/// __Semantics__:
552/// Return input string, but modified as follows:
553/// 
554/// ●If the first character is a letter, it is converted to its uppercase 
555/// equivalent; otherwise, the original character is returned
556/// 
557/// ●If a letter is preceded by a non-letter, it is converted to its 
558/// uppercase equivalent
559/// 
560/// ●If a letter is preceded by a letter, it is converted to its lowercase 
561/// equivalent.
562/// 
563/// Evaluators shall implement this for at least the Latin letters A-Z and a-z.
564/// 
565/// As with most functions, it is side-effect free, that is, it does not modify 
566/// the source values.
567///
568/// __See also__: [crate::of::lower()], [crate::of::upper()], 
569#[inline]
570pub fn proper<A: Text>(t: A) -> FnText1<A> {
571    FnText1("PROPER", t)
572}
573
574/// Returns text where an old text is substituted with a new text.
575///
576/// [documentfoundation->REPLACE](https://wiki.documentfoundation.org/Documentation/Calc_Functions/REPLACE)
577///
578/// __Syntax__: 
579/// ```ods
580///     REPLACE( T: Text; Start: Number; Count: Number; New: Text )
581/// ```
582///
583/// __Constraints__:
584/// Start ≥ 1.
585///
586/// __Semantics__:
587/// Returns text T, but remove the characters starting at character position 
588/// Start for Count characters, and instead replace them with New. Character 
589/// positions defined by Start begin at 1 (for the leftmost character). If 
590/// Count=0, the text New is inserted before character position Start, and all 
591/// the text before and after Start is retained. If Start > length of text T 
592/// (TLen) then Start is set to TLen. If Count > TLen - Start then Count is set 
593/// to TLen - Start.
594/// 
595/// REPLACE(T;Start;Len;New) is the same as LEFT(T;Start - 1) & New & MID(T; 
596/// Start + Len; LEN(T)))
597///
598/// __See also__: [crate::of::left()], [crate::of::len()], [crate::of::mid()], [crate::of::right()], [crate::of::substitute()], 
599#[inline]
600pub fn replace<A: Text, B: Number, C: Number, D: Text>(t: A, start: B, count: C, new: D) -> FnText4<A, B, C, D> {
601    FnText4("REPLACE", t, start, count, new)
602}
603
604/// Return text repeated Count times.
605///
606/// [documentfoundation->REPT](https://wiki.documentfoundation.org/Documentation/Calc_Functions/REPT)
607///
608/// __Syntax__: 
609/// ```ods
610///     REPT( T: Text; Count: Integer )
611/// ```
612///
613/// __Constraints__:
614/// Count ≥ 0
615///
616/// __Semantics__:
617/// Returns text T repeated Count number of times; if Count is zero, an empty 
618/// string is returned. If Count < 0, the result is Error.
619///
620/// __See also__: [crate::of::left()], [crate::of::mid()], [crate::of::right()], [crate::of::substitute()], 
621#[inline]
622pub fn rept<A: Text, B: Number>(t: A, count: B) -> FnText2<A, B> {
623    FnText2("REPT", t, count)
624}
625
626/// Return a selected number of text characters from the right.
627///
628/// [documentfoundation->RIGHT](https://wiki.documentfoundation.org/Documentation/Calc_Functions/RIGHT)
629///
630/// __Syntax__: 
631/// ```ods
632///     RIGHT( T: Text )
633/// ```
634///
635/// __Constraints__:
636/// Length ≥ 0
637///
638/// __Semantics__:
639/// Returns the Length number of characters of text T, starting from the right. 
640/// If Length is omitted, it defaults to 1; otherwise, it computes Length = 
641/// INT(Length). If T has fewer than Length characters, it returns T 
642/// (unchanged). This means that if T is an empty string (which has length 0) 
643/// or the parameter Length is 0, RIGHT() will always return an empty string. 
644/// Note that if Length < 0, an Error is returned.
645/// 
646/// The results of this function may be normalization-sensitive. 4.2
647///
648/// __See also__: [crate::of::int()], [crate::of::left()], [crate::of::len()], [crate::of::mid()], [crate::of::right_()], 
649#[inline]
650pub fn right<A: Text>(t: A) -> FnText1<A> {
651    FnText1("RIGHT", t)
652}
653
654/// Return a selected number of text characters from the right.
655///
656/// [documentfoundation->RIGHT](https://wiki.documentfoundation.org/Documentation/Calc_Functions/RIGHT)
657///
658/// __Syntax__: 
659/// ```ods
660///     RIGHT( T: Text; Length: Integer )
661/// ```
662///
663/// __Constraints__:
664/// Length ≥ 0
665///
666/// __Semantics__:
667/// Returns the Length number of characters of text T, starting from the right. 
668/// If Length is omitted, it defaults to 1; otherwise, it computes Length = 
669/// INT(Length). If T has fewer than Length characters, it returns T 
670/// (unchanged). This means that if T is an empty string (which has length 0) 
671/// or the parameter Length is 0, RIGHT() will always return an empty string. 
672/// Note that if Length < 0, an Error is returned.
673/// 
674/// The results of this function may be normalization-sensitive. 4.2
675///
676/// __See also__: [crate::of::int()], [crate::of::left()], [crate::of::len()], [crate::of::mid()], [crate::of::right()], 
677#[inline]
678pub fn right_<A: Text, B: Number>(t: A, length: B) -> FnText2<A, B> {
679    FnText2("RIGHT", t, length)
680}
681
682/// Return the starting position of a given text.
683///
684/// [documentfoundation->SEARCH](https://wiki.documentfoundation.org/Documentation/Calc_Functions/SEARCH)
685///
686/// __Syntax__: 
687/// ```ods
688///     SEARCH( Search: Text; T: Text )
689/// ```
690///
691/// __Constraints__:
692/// Start ≥ 1
693///
694/// __Semantics__:
695/// Returns the character position where Search is first found in T, when the 
696/// search is started from character position Start. The match is not 
697/// case-sensitive. Start is 1 if omitted. Returns an Error if text not found.
698/// 
699/// The values returned may vary depending upon the 
700/// HOST-USE-REGULAR-EXPRESSIONS or HOST-USE-WILDCARDS properties. 3.4
701///
702/// __See also__: [crate::of::exact()], [crate::of::find()], [crate::of::search_()], 
703#[inline]
704pub fn search<A: Text, B: Text>(search: A, t: B) -> FnNumber2<A, B> {
705    FnNumber2("SEARCH", search, t)
706}
707
708/// Return the starting position of a given text.
709///
710/// [documentfoundation->SEARCH](https://wiki.documentfoundation.org/Documentation/Calc_Functions/SEARCH)
711///
712/// __Syntax__: 
713/// ```ods
714///     SEARCH( Search: Text; T: Text; Start: Integer )
715/// ```
716///
717/// __Constraints__:
718/// Start ≥ 1
719///
720/// __Semantics__:
721/// Returns the character position where Search is first found in T, when the 
722/// search is started from character position Start. The match is not 
723/// case-sensitive. Start is 1 if omitted. Returns an Error if text not found.
724/// 
725/// The values returned may vary depending upon the 
726/// HOST-USE-REGULAR-EXPRESSIONS or HOST-USE-WILDCARDS properties. 3.4
727///
728/// __See also__: [crate::of::exact()], [crate::of::find()], [crate::of::search()], 
729#[inline]
730pub fn search_<A: Text, B: Text, C: Number>(search: A, t: B, start: C) -> FnNumber3<A, B, C> {
731    FnNumber3("SEARCH", search, t, start)
732}
733
734/// Returns text where an old text is substituted with a new text.
735///
736/// [documentfoundation->SUBSTITUTE](https://wiki.documentfoundation.org/Documentation/Calc_Functions/SUBSTITUTE)
737///
738/// __Syntax__: 
739/// ```ods
740///     SUBSTITUTE( T: Text; Old: Text; New: Text )
741/// ```
742///
743/// __Constraints__:
744/// Which ≥ 1 (when provided)
745///
746/// __Semantics__:
747/// Returns text T, but with text Old replaced by text New (when searching from 
748/// the left). If Which is omitted, every occurrence of Old is replaced with 
749/// New; if Which is provided, only that occurrence of Old is replaced by New 
750/// (starting the count from 1). If there is no match, or if Old has length 0, 
751/// the value of T is returned. Note that Old and New may have different 
752/// lengths. If Which is present and Which < 1, returns Error.
753///
754/// __See also__: [crate::of::left()], [crate::of::len()], [crate::of::mid()], [crate::of::replace()], [crate::of::right()], [crate::of::substitute_()], 
755#[inline]
756pub fn substitute<A: Text, B: Text, C: Text>(t: A, old: B, new: C) -> FnText3<A, B, C> {
757    FnText3("SUBSTITUTE", t, old, new)
758}
759
760/// Returns text where an old text is substituted with a new text.
761///
762/// [documentfoundation->SUBSTITUTE](https://wiki.documentfoundation.org/Documentation/Calc_Functions/SUBSTITUTE)
763///
764/// __Syntax__: 
765/// ```ods
766///     SUBSTITUTE( T: Text; Old: Text; New: Text; Which: Integer )
767/// ```
768///
769/// __Constraints__:
770/// Which ≥ 1 (when provided)
771///
772/// __Semantics__:
773/// Returns text T, but with text Old replaced by text New (when searching from 
774/// the left). If Which is omitted, every occurrence of Old is replaced with 
775/// New; if Which is provided, only that occurrence of Old is replaced by New 
776/// (starting the count from 1). If there is no match, or if Old has length 0, 
777/// the value of T is returned. Note that Old and New may have different 
778/// lengths. If Which is present and Which < 1, returns Error.
779///
780/// __See also__: [crate::of::left()], [crate::of::len()], [crate::of::mid()], [crate::of::replace()], [crate::of::right()], [crate::of::substitute()], 
781#[inline]
782pub fn substitute_<A: Text, B: Text, C: Text, D: Number>(t: A, old: B, new: C, which: D) -> FnText4<A, B, C, D> {
783    FnText4("SUBSTITUTE", t, old, new, which)
784}
785
786/// Return the text (if Text), else return 0-length Text value
787///
788/// [documentfoundation->T](https://wiki.documentfoundation.org/Documentation/Calc_Functions/T)
789///
790/// __Syntax__: 
791/// ```ods
792///     T( X: Any )
793/// ```
794///
795/// __Constraints__:
796/// None
797///
798/// __Semantics__:
799/// The type of (a dereferenced) X is examined; if it is of type Text, it is 
800/// returned, else an empty string (Text value of zero length) is returned. 
801/// This is not a type-conversion function; T(5) produces an empty string, not 
802/// "5".
803///
804/// __See also__: [crate::of::n()], 
805#[inline]
806pub fn t<A: Any>(x: A) -> FnText1<A> {
807    FnText1("T", x)
808}
809
810/// Return the value converted to a text.
811///
812/// [documentfoundation->TEXT](https://wiki.documentfoundation.org/Documentation/Calc_Functions/TEXT)
813///
814/// __Syntax__: 
815/// ```ods
816///     TEXT( X: Scalar; FormatCode: Text )
817/// ```
818///
819/// __Constraints__:
820/// The FormatCode is a sequence of characters with an implementation-defined 
821/// meaning.
822///
823/// __Semantics__:
824/// Converts the value X to a Text according to the rules of a number format 
825/// code passed as FormatCode and returns it.
826///
827/// __See also__: [crate::of::n()], [crate::of::t()], 
828#[inline]
829pub fn text<A: Scalar, B: Text>(x: A, format_code: B) -> FnText2<A, B> {
830    FnText2("TEXT", x, format_code)
831}
832
833/// Remove leading and trailing spaces, and replace all internal multiple 
834/// spaces with a single space.
835///
836/// [documentfoundation->TRIM](https://wiki.documentfoundation.org/Documentation/Calc_Functions/TRIM)
837///
838/// __Syntax__: 
839/// ```ods
840///     TRIM( T: Text )
841/// ```
842///
843/// __Constraints__:
844/// None.
845///
846/// __Semantics__:
847/// Takes T and removes all leading and trailing space. Any other sequence of 2 
848/// or more spaces is replaced with a single space.
849/// 
850/// A space is one or more, HORIZONTAL TABULATION (U+0009), LINE FEED (U+000A), 
851/// CARRIAGE RETURN (U+000D) or SPACE (U+0020) characters.
852///
853/// __See also__: [crate::of::left()], [crate::of::right()], 
854#[inline]
855pub fn trim<A: Text>(t: A) -> FnText1<A> {
856    FnText1("TRIM", t)
857}
858
859/// Return the character represented by the given numeric value according to 
860/// the UNICODE Standard.
861///
862/// [documentfoundation->UNICHAR](https://wiki.documentfoundation.org/Documentation/Calc_Functions/UNICHAR)
863///
864/// __Syntax__: 
865/// ```ods
866///     UNICHAR( N: Integer )
867/// ```
868///
869/// __Constraints__:
870/// N ≥ 0, N ≤ 1114111 (U+10FFFF)
871///
872/// __Semantics__:
873/// Returns the character having the given numeric value as UNICODE code point.
874/// Evaluators shall support values between 1 and 0xFFFF. Evaluators should 
875/// allow N to be any UNICODE code point of type Graphic, Format or Control. 
876/// Evaluators should implement UNICHAR such that UNICODE(UNICHAR(N)) returns N 
877/// for any UNICODE code point N of type Graphic, Format or Control.
878///
879/// __See also__: [crate::of::unicode()], 
880#[inline]
881pub fn unichar<A: Number>(n: A) -> FnText1<A> {
882    FnText1("UNICHAR", n)
883}
884
885/// Return the UNICODE code point corresponding to the first character of the 
886/// text value.
887///
888/// [documentfoundation->UNICODE](https://wiki.documentfoundation.org/Documentation/Calc_Functions/UNICODE)
889///
890/// __Syntax__: 
891/// ```ods
892///     UNICODE( T: Text )
893/// ```
894///
895/// __Constraints__:
896/// Length(T) > 0.
897///
898/// __Semantics__:
899/// Returns the numeric value of the UNICODE code point of the first character 
900/// of the given text T.
901/// 
902/// The results of this function may be normalization-sensitive. 4.2
903///
904/// __See also__: [crate::of::unichar()], 
905#[inline]
906pub fn unicode<A: Text>(t: A) -> FnNumber1<A> {
907    FnNumber1("UNICODE", t)
908}
909
910/// Return input string, but with all lowercase letters converted to uppercase 
911/// letters.
912///
913/// [documentfoundation->UPPER](https://wiki.documentfoundation.org/Documentation/Calc_Functions/UPPER)
914///
915/// __Syntax__: 
916/// ```ods
917///     UPPER( T: Text )
918/// ```
919///
920/// __Constraints__:
921/// None
922///
923/// __Semantics__:
924/// Return input string, but with all lowercase letters converted to uppercase 
925/// letters, as defined by §3.13 Default Case Algorithms, §4.2 Case-Normative 
926/// and §5.18 Case Mappings of UNICODE. As with most functions, it is 
927/// side-effect free (it does not modify the source values). All Evaluators 
928/// shall convert a-z to A-Z.
929///
930/// __Note__:
931/// As this function can be locale aware, results may be unexpected in certain 
932/// cases, for example in a Turkish locale a lower case "i with dot" (LATIN 
933/// SMALL LETTER I) U+0069 is converted to an upper case "I with dot" (LATIN 
934/// CAPITAL LETTER I WITH DOT ABOVE, U+0130).
935///
936/// __See also__: [crate::of::lower()], [crate::of::proper()], 
937#[inline]
938pub fn upper<A: Text>(t: A) -> FnText1<A> {
939    FnText1("UPPER", t)
940}