spreadsheet_ods_formula/generated/textb.rs
1//!
2//! Byte-position text functions are like their equivalent ordinary text
3//! functions, but manipulate byte positions rather than a count of the number
4//! of characters. Byte positions are integers that may depend on the specific
5//! text representation used by the implementation. Byte positions are by
6//! definition implementation-dependent and reliance upon them reduces
7//! interoperability.
8//!
9//! The pseudotypes ByteLength and BytePosition are Integers, but their exact
10//! meanings and values are not further defined by this specification.
11
12use crate::*;
13#[allow(unused_imports)]
14use crate::textb::*;
15
16/// Returns the starting position of a given text, using byte positions.
17///
18/// [documentfoundation->FINDB](https://wiki.documentfoundation.org/Documentation/Calc_Functions/FINDB)
19///
20/// __Syntax__:
21/// ```ods
22/// FINDB( Search: Text; T: Text )
23/// ```
24///
25/// __Semantics__:
26/// The same as FIND, but using byte positions.
27///
28/// __See also__: [crate::of::find()], [crate::of::leftb()], [crate::of::rightb()], [crate::of::findb_()],
29#[inline]
30pub fn findb<A: Text, B: Text>(search: A, t: B) -> FnNumber2<A, B> {
31 FnNumber2("FINDB", search, t)
32}
33
34/// Returns the starting position of a given text, using byte positions.
35///
36/// [documentfoundation->FINDB](https://wiki.documentfoundation.org/Documentation/Calc_Functions/FINDB)
37///
38/// __Syntax__:
39/// ```ods
40/// FINDB( Search: Text; T: Text; Start: BytePosition )
41/// ```
42///
43/// __Semantics__:
44/// The same as FIND, but using byte positions.
45///
46/// __See also__: [crate::of::find()], [crate::of::leftb()], [crate::of::rightb()], [crate::of::findb()],
47#[inline]
48pub fn findb_<A: Text, B: Text, C: Number>(search: A, t: B, start: C) -> FnNumber3<A, B, C> {
49 FnNumber3("FINDB", search, t, start)
50}
51
52/// Returns a selected number of text characters from the left, using a byte
53/// position.
54///
55/// [documentfoundation->LEFTB](https://wiki.documentfoundation.org/Documentation/Calc_Functions/LEFTB)
56///
57/// __Syntax__:
58/// ```ods
59/// LEFTB( T: Text )
60/// ```
61///
62/// __Semantics__:
63/// As LEFT, but using a byte position.
64///
65/// __See also__: [crate::of::left()], [crate::of::right()], [crate::of::rightb()], [crate::of::leftb_()],
66#[inline]
67pub fn leftb<A: Text>(t: A) -> FnText1<A> {
68 FnText1("LEFTB", t)
69}
70
71/// Returns a selected number of text characters from the left, using a byte
72/// position.
73///
74/// [documentfoundation->LEFTB](https://wiki.documentfoundation.org/Documentation/Calc_Functions/LEFTB)
75///
76/// __Syntax__:
77/// ```ods
78/// LEFTB( T: Text; Length: ByteLength )
79/// ```
80///
81/// __Semantics__:
82/// As LEFT, but using a byte position.
83///
84/// __See also__: [crate::of::left()], [crate::of::right()], [crate::of::rightb()], [crate::of::leftb()],
85#[inline]
86pub fn leftb_<A: Text, B: Number>(t: A, length: B) -> FnText2<A, B> {
87 FnText2("LEFTB", t, length)
88}
89
90/// Returns the length of given text in units compatible with byte positions
91///
92/// [documentfoundation->LENB](https://wiki.documentfoundation.org/Documentation/Calc_Functions/LENB)
93///
94/// __Syntax__:
95/// ```ods
96/// LENB( T: Text )
97/// ```
98///
99/// __Constraints__:
100/// None.
101///
102/// __Semantics__:
103/// As LEN, but compatible with byte position values.
104///
105/// __See also__: [crate::of::len()], [crate::of::leftb()], [crate::of::rightb()],
106#[inline]
107pub fn lenb<A: Text>(t: A) -> FnNumber1<A> {
108 FnNumber1("LENB", t)
109}
110
111/// Returns extracted text, given an original text, starting position using a
112/// byte position, and length.
113///
114/// [documentfoundation->MIDB](https://wiki.documentfoundation.org/Documentation/Calc_Functions/MIDB)
115///
116/// __Syntax__:
117/// ```ods
118/// MIDB( T: Text; Start: BytePosition; Length: ByteLength )
119/// ```
120///
121/// __Constraints__:
122/// Length ≥ 0.
123///
124/// __Semantics__:
125/// As MID, but using byte positions.
126///
127/// __See also__: [crate::of::mid()], [crate::of::leftb()], [crate::of::rightb()], [crate::of::replaceb()],
128#[inline]
129pub fn midb<A: Text, B: Number, C: Number>(t: A, start: B, length: C) -> FnText3<A, B, C> {
130 FnText3("MIDB", t, start, length)
131}
132
133/// Returns text where an old text is replaced with a new text, using byte
134/// positions.
135///
136/// [documentfoundation->REPLACEB](https://wiki.documentfoundation.org/Documentation/Calc_Functions/REPLACEB)
137///
138/// __Syntax__:
139/// ```ods
140/// REPLACEB( T: Text; Start: BytePosition; Len: ByteLength; New: Text )
141/// ```
142///
143/// __Semantics__:
144/// As REPLACE, but using byte positions.
145///
146/// __See also__: [crate::of::replace()], [crate::of::leftb()], [crate::of::rightb()], [crate::of::midb()], [crate::of::substitute()],
147#[inline]
148pub fn replaceb<A: Text, B: Number, C: Number, D: Text>(t: A, start: B, len: C, new: D) -> FnText4<A, B, C, D> {
149 FnText4("REPLACEB", t, start, len, new)
150}
151
152/// Returns a selected number of text characters from the right, using byte
153/// position.
154///
155/// [documentfoundation->RIGHTB](https://wiki.documentfoundation.org/Documentation/Calc_Functions/RIGHTB)
156///
157/// __Syntax__:
158/// ```ods
159/// RIGHTB( T: Text )
160/// ```
161///
162/// __Semantics__:
163/// As RIGHT, but using byte positions.
164///
165/// __See also__: [crate::of::right()], [crate::of::leftb()], [crate::of::rightb_()],
166#[inline]
167pub fn rightb<A: Text>(t: A) -> FnText1<A> {
168 FnText1("RIGHTB", t)
169}
170
171/// Returns a selected number of text characters from the right, using byte
172/// position.
173///
174/// [documentfoundation->RIGHTB](https://wiki.documentfoundation.org/Documentation/Calc_Functions/RIGHTB)
175///
176/// __Syntax__:
177/// ```ods
178/// RIGHTB( T: Text; Length: ByteLength )
179/// ```
180///
181/// __Semantics__:
182/// As RIGHT, but using byte positions.
183///
184/// __See also__: [crate::of::right()], [crate::of::leftb()], [crate::of::rightb()],
185#[inline]
186pub fn rightb_<A: Text, B: Number>(t: A, length: B) -> FnText2<A, B> {
187 FnText2("RIGHTB", t, length)
188}
189
190/// Returns the starting position of a given text, using byte positions.
191///
192/// [documentfoundation->SEARCHB](https://wiki.documentfoundation.org/Documentation/Calc_Functions/SEARCHB)
193///
194/// __Syntax__:
195/// ```ods
196/// SEARCHB( Search: Text; T: Text )
197/// ```
198///
199/// __Semantics__:
200/// As SEARCH, but using byte positions.
201///
202/// __See also__: [crate::of::search()], [crate::of::exact()], [crate::of::find()], [crate::of::findb()], [crate::of::searchb_()],
203#[inline]
204pub fn searchb<A: Text, B: Text>(search: A, t: B) -> FnNumber2<A, B> {
205 FnNumber2("SEARCHB", search, t)
206}
207
208/// Returns the starting position of a given text, using byte positions.
209///
210/// [documentfoundation->SEARCHB](https://wiki.documentfoundation.org/Documentation/Calc_Functions/SEARCHB)
211///
212/// __Syntax__:
213/// ```ods
214/// SEARCHB( Search: Text; T: Text; Start: BytePosition )
215/// ```
216///
217/// __Semantics__:
218/// As SEARCH, but using byte positions.
219///
220/// __See also__: [crate::of::search()], [crate::of::exact()], [crate::of::find()], [crate::of::findb()], [crate::of::searchb()],
221#[inline]
222pub fn searchb_<A: Text, B: Text, C: Number>(search: A, t: B, start: C) -> FnNumber3<A, B, C> {
223 FnNumber3("SEARCHB", search, t, start)
224}