1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
//! Line-based text operations
//!
//! Provides utilities for head/tail line extraction and line-based truncation.
//!
//! # Examples
//!
//! ```rust
//! # #[ cfg( all( feature = "string_split", feature = "std" ) ) ]
//! # {
//! use strs_tools::string::lines::{ head, tail, head_and_tail };
//!
//! let text = "line1\nline2\nline3\nline4\nline5";
//!
//! // Get first 2 lines
//! assert_eq!( head( text, 2 ), "line1\nline2" );
//!
//! // Get last 2 lines
//! assert_eq!( tail( text, 2 ), "line4\nline5" );
//!
//! // Get head + tail with omission count
//! let ( result, omitted ) = head_and_tail( text, 2, 2 );
//! assert_eq!( result, "line1\nline2\nline4\nline5" );
//! assert_eq!( omitted, 1 );
//! # }
//! ```
use ;
use ;
/// Extract first N lines from text.
///
/// # Arguments
///
/// * `text` - Input text (multiline)
/// * `count` - Number of lines to keep
///
/// # Returns
///
/// String containing only the first N lines.
///
/// # Examples
///
/// ```rust
/// # #[ cfg( all( feature = "string_split", feature = "std" ) ) ]
/// # {
/// use strs_tools::string::lines::head;
///
/// let text = "line1\nline2\nline3";
/// assert_eq!( head( text, 2 ), "line1\nline2" );
///
/// // Requesting more than available returns all
/// assert_eq!( head( text, 10 ), "line1\nline2\nline3" );
/// # }
/// ```
/// Extract last N lines from text.
///
/// # Arguments
///
/// * `text` - Input text (multiline)
/// * `count` - Number of lines to keep
///
/// # Returns
///
/// String containing only the last N lines.
///
/// # Examples
///
/// ```rust
/// # #[ cfg( all( feature = "string_split", feature = "std" ) ) ]
/// # {
/// use strs_tools::string::lines::tail;
///
/// let text = "line1\nline2\nline3";
/// assert_eq!( tail( text, 2 ), "line2\nline3" );
///
/// // Requesting more than available returns all
/// assert_eq!( tail( text, 10 ), "line1\nline2\nline3" );
/// # }
/// ```
/// Extract head + tail with omission marker.
///
/// When head + tail counts exceed total lines, returns all lines with no omission.
/// Otherwise, returns head lines concatenated with tail lines, plus count of omitted middle lines.
///
/// # Arguments
///
/// * `text` - Input text (multiline)
/// * `head_count` - Lines to keep from start
/// * `tail_count` - Lines to keep from end
///
/// # Returns
///
/// Tuple of (selected_lines, omitted_count)
///
/// # Examples
///
/// ```rust
/// # #[ cfg( all( feature = "string_split", feature = "std" ) ) ]
/// # {
/// use strs_tools::string::lines::head_and_tail;
///
/// let text = "line1\nline2\nline3\nline4\nline5";
///
/// // Head 2 + tail 2 = omit 1 middle line
/// let ( result, omitted ) = head_and_tail( text, 2, 2 );
/// assert_eq!( result, "line1\nline2\nline4\nline5" );
/// assert_eq!( omitted, 1 );
///
/// // Overlap returns all
/// let ( result, omitted ) = head_and_tail( text, 3, 3 );
/// assert_eq!( result, "line1\nline2\nline3\nline4\nline5" );
/// assert_eq!( omitted, 0 );
/// # }
/// ```
/// Own namespace of the module.
pub use *;
/// Own namespace of the module.
/// Parented namespace of the module.
/// Exposed namespace of the module.
/// Namespace of the module to include with `use module::*`.