Rosetta
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
string.functions.hh
Go to the documentation of this file.
1 #ifndef INCLUDED_ObjexxFCL_string_functions_HH
2 #define INCLUDED_ObjexxFCL_string_functions_HH
3 
4 
5 // String Functions
6 //
7 // Project: Objexx Fortran Compatibility Library (ObjexxFCL)
8 //
9 // Version: 3.0.0
10 //
11 // Language: C++
12 //
13 // Copyright (c) 2000-2009 Objexx Engineering, Inc. All Rights Reserved.
14 // Use of this source code or any derivative of it is restricted by license.
15 // Licensing is available from Objexx Engineering, Inc.: http://objexx.com Objexx@objexx.com
16 
17 
18 // ObjexxFCL Headers
19 #include <ObjexxFCL/TypeTraits.hh>
20 
21 // C++ Headers
22 #include <iomanip>
23 #include <sstream>
24 #include <string>
25 #include <vector>
26 
27 
28 namespace ObjexxFCL {
29 
30 
31 // Types
32 typedef char * cstring;
33 typedef char const * c_cstring;
34 
35 
36 // Predicate
37 
38 
39 /// @brief string == string Case-Insensitively?
40 bool
41 equali( std::string const & s, std::string const & t );
42 
43 
44 /// @brief string == cstring Case-Insensitively?
45 bool
46 equali( std::string const & s, c_cstring const t );
47 
48 
49 /// @brief cstring == string Case-Insensitively?
50 bool
51 equali( c_cstring const s, std::string const & t );
52 
53 
54 /// @brief string == string Case-Optionally?
55 inline
56 bool
57 equal( std::string const & s, std::string const & t, bool const exact_case = true )
58 {
59  if ( exact_case ) {
60  return ( s == t );
61  } else {
62  return equali( s, t );
63  }
64 }
65 
66 
67 /// @brief string is Blank?
68 inline
69 bool
70 is_blank( std::string const & s )
71 {
72  if ( s.empty() ) {
73  return true;
74  } else {
75  return ( s.find_first_not_of( ' ' ) == std::string::npos );
76  }
77 }
78 
79 
80 /// @brief string is Not Blank?
81 inline
82 bool
83 not_blank( std::string const & s )
84 {
85  return ( ! is_blank( s ) );
86 }
87 
88 
89 /// @brief string is Whitespace?
90 inline
91 bool
92 is_whitespace( std::string const & s )
93 {
94  if ( s.empty() ) {
95  return true;
96  } else {
97  return ( s.find_last_not_of( " \t\000" ) == std::string::npos );
98  }
99 }
100 
101 
102 /// @brief string is Not Whitespace?
103 inline
104 bool
105 not_whitespace( std::string const & s )
106 {
107  return ( ! is_whitespace( s ) );
108 }
109 
110 
111 /// @brief string has a string?
112 inline
113 bool
114 has( std::string const & s, std::string const & t )
115 {
116  return ( s.find( t ) != std::string::npos );
117 }
118 
119 
120 /// @brief string has a cstring?
121 inline
122 bool
123 has( std::string const & s, c_cstring const t )
124 {
125  return ( s.find( t ) != std::string::npos );
126 }
127 
128 
129 /// @brief string has a Character?
130 inline
131 bool
132 has( std::string const & s, char const c )
133 {
134  return ( s.find( c ) != std::string::npos );
135 }
136 
137 
138 /// @brief string has Any Character of a string?
139 inline
140 bool
141 has_any_of( std::string const & s, std::string const & t )
142 {
143  return ( s.find_first_of( t ) != std::string::npos );
144 }
145 
146 
147 /// @brief string has a Character?
148 inline
149 bool
150 has_any_of( std::string const & s, char const c )
151 {
152  return ( s.find( c ) != std::string::npos );
153 }
154 
155 
156 /// @brief Has a Prefix Case-Optionally?
157 bool
158 has_prefix( std::string const & s, std::string const & pre, bool const exact_case = true );
159 
160 
161 /// @brief Has a Suffix Case-Optionally?
162 bool
163 has_suffix( std::string const & s, std::string const & suf, bool const exact_case = true );
164 
165 
166 // Inspector
167 
168 
169 /// @brief Length Space-Trimmed
170 inline
171 std::string::size_type
172 len_trim( std::string const & s )
173 {
174  return s.find_last_not_of( ' ' ) + 1; // Works if npos returned: npos + 1 == 0
175 }
176 
177 
178 /// @brief Length Whitespace-Trimmed
179 inline
180 std::string::size_type
181 len_trim_whitespace( std::string const & s )
182 {
183  return s.find_last_not_of( " \t\000" ) + 1; // Works if npos returned: npos + 1 == 0
184 }
185 
186 
187 // Modifier
188 
189 
190 /// @brief Lowercase a string
191 std::string &
192 lowercase( std::string & s );
193 
194 
195 /// @brief Uppercase a string
196 std::string &
197 uppercase( std::string & s );
198 
199 
200 /// @brief Left Justify a string
201 std::string &
202 left_justify( std::string & s );
203 
204 
205 /// @brief Right Justify a string
206 std::string &
207 right_justify( std::string & s );
208 
209 
210 /// @brief Trim Trailing Space from a string
211 std::string &
212 trim( std::string & s );
213 
214 
215 /// @brief Trim Trailing Whitespace from a string
216 std::string &
217 trim_whitespace( std::string & s );
218 
219 
220 /// @brief Strip Specified Characters from a string's Tails
221 std::string &
222 strip( std::string & s, std::string const & chars );
223 
224 
225 /// @brief Strip Specified Characters from a string's Left Tail
226 std::string &
227 lstrip( std::string & s, std::string const & chars );
228 
229 
230 /// @brief Strip Specified Characters from a string's Right Tail
231 std::string &
232 rstrip( std::string & s, std::string const & chars );
233 
234 
235 /// @brief Strip Space from a string's Tails
236 std::string &
237 strip( std::string & s );
238 
239 
240 /// @brief Strip Space from a string's Left Tail
241 std::string &
242 lstrip( std::string & s );
243 
244 
245 /// @brief Strip Space from a string's Right Tail
246 std::string &
247 rstrip( std::string & s );
248 
249 
250 /// @brief Strip Whitespace from a string's Tails
251 std::string &
252 strip_whitespace( std::string & s );
253 
254 
255 /// @brief Strip Whitespace from a string's Left Tail
256 std::string &
257 lstrip_whitespace( std::string & s );
258 
259 
260 /// @brief Strip Whitespace from a string's Right Tail
261 std::string &
262 rstrip_whitespace( std::string & s );
263 
264 
265 /// @brief Pad a string to a Specified Length
266 std::string &
267 pad( std::string & s, std::string::size_type const len );
268 
269 
270 /// @brief Left-Pad a string to a Specified Length
271 std::string &
272 lpad( std::string & s, std::string::size_type const len );
273 
274 
275 /// @brief Right-Pad a string to a Specified Length
276 std::string &
277 rpad( std::string & s, std::string::size_type const len );
278 
279 
280 /// @brief Size a string to a Specified Length
281 std::string &
282 size( std::string & s, std::string::size_type const len );
283 
284 
285 /// @brief Center a string wrt its Whitespace
286 std::string &
287 center( std::string & s );
288 
289 
290 /// @brief Center a string with a Specified Length
291 std::string &
292 center( std::string & s, std::string::size_type const len );
293 
294 
295 /// @brief Remove Repeat Characters from a Possibly Unsorted string Preserving Order
296 std::string &
297 unique( std::string & s );
298 
299 
300 /// @brief Overlay a string With Another string, Expanding Size as Needed
301 std::string &
302 overlay( std::string & s, std::string const & t, std::string::size_type const pos = 0 );
303 
304 
305 // Generator
306 
307 
308 /// @brief Blank string of Specified Length
309 inline
310 std::string
311 blank( std::string::size_type const len )
312 {
313  return std::string( len, ' ' );
314 }
315 
316 
317 /// @brief Lowercased Copy of a string
318 std::string
319 lowercased( std::string const & s );
320 
321 
322 /// @brief Uppercased Copy of a string
323 std::string
324 uppercased( std::string const & s );
325 
326 
327 /// @brief Left-Justified Copy of a string
328 std::string
329 left_justified( std::string const & s );
330 
331 
332 /// @brief Right-Justified Copy of a string
333 std::string
334 right_justified( std::string const & s );
335 
336 
337 /// @brief Trailing Space Trimmed Copy of a string
338 std::string
339 trimmed( std::string const & s );
340 
341 
342 /// @brief Trailing Whitespace Trimmed Copy of a string
343 std::string
344 trimmed_whitespace( std::string const & s );
345 
346 
347 /// @brief Specified Characters Stripped from a string's Tails Copy of a string
348 std::string
349 stripped( std::string const & s, std::string const & chars );
350 
351 
352 /// @brief Specified Characters Stripped from a string's Left Tail Copy of a string
353 std::string
354 lstripped( std::string const & s, std::string const & chars );
355 
356 
357 /// @brief Specified Characters Stripped from a string's Right Tail Copy of a string
358 std::string
359 rstripped( std::string const & s, std::string const & chars );
360 
361 
362 /// @brief Space Stripped from a string's Tails Copy of a string
363 std::string
364 stripped( std::string const & s );
365 
366 
367 /// @brief Space Stripped from a string's Left Tail Copy of a string
368 std::string
369 lstripped( std::string const & s );
370 
371 
372 /// @brief Space Stripped from a string's Right Tail Copy of a string
373 std::string
374 rstripped( std::string const & s );
375 
376 
377 /// @brief Whitespace Stripped from a string's Tails Copy of a string
378 std::string
379 stripped_whitespace( std::string const & s );
380 
381 
382 /// @brief Whitespace Stripped from a string's Left Tail Copy of a string
383 std::string
384 lstripped_whitespace( std::string const & s );
385 
386 
387 /// @brief Whitespace Stripped from a string's Right Tail Copy of a string
388 std::string
389 rstripped_whitespace( std::string const & s );
390 
391 
392 /// @brief Padded to a Specified Length Copy of a string
393 std::string
394 padded( std::string const & s, std::string::size_type const len );
395 
396 
397 /// @brief Left-Padded to a Specified Length Copy of a string
398 std::string
399 lpadded( std::string const & s, std::string::size_type const len );
400 
401 
402 /// @brief Right-Padded to a Specified Length Copy of a string
403 std::string
404 rpadded( std::string const & s, std::string::size_type const len );
405 
406 
407 /// @brief Sized to a Specified Length Copy of a string
408 std::string
409 sized( std::string const & s, std::string::size_type const len );
410 
411 
412 /// @brief Centered wrt Whitespace Copy of a string
413 std::string
414 centered( std::string const & s );
415 
416 
417 /// @brief Centered in a string of Specified Length Copy of a string
418 std::string
419 centered( std::string const & s, std::string::size_type const len );
420 
421 
422 /// @brief Removed Repeat Characters from a Possibly Unsorted string Preserving Order Copy of a string
423 std::string
424 uniqued( std::string const & s );
425 
426 
427 /// @brief Space-Free Head Copy of a string
428 std::string
429 head( std::string const & s );
430 
431 
432 // Conversion To std::string
433 
434 
435 /// @brief string of a Template Argument Type Supporting Stream Output
436 template< typename T >
437 inline
438 std::string
439 string_of( T const & t )
440 {
441  std::ostringstream t_stream;
442  t_stream << std::uppercase << std::setprecision( TypeTraits< T >::precision() ) << t;
443  return t_stream.str();
444 }
445 
446 
447 /// @brief string of a Template Argument Type Supporting Stream Output
448 template< typename T >
449 inline
450 std::string
452  T const & t,
453  int const p // Precision
454 )
455 {
456  std::ostringstream t_stream;
457  t_stream << std::uppercase << std::setprecision( p ) << t;
458  return t_stream.str();
459 }
460 
461 
462 /// @brief Left-Justified string of a Template Argument Type Supporting Stream Output
463 template< typename T >
464 inline
465 std::string
467  T const & t,
468  int const w, // Minimum width
469  char const f = ' ' // Fill character
470 )
471 {
472  std::ostringstream t_stream;
473  t_stream << std::left << std::uppercase
474  << std::setw( w ) << std::setfill( f ) << std::setprecision( TypeTraits< T >::precision() ) << t;
475  return t_stream.str();
476 }
477 
478 
479 /// @brief Right-Justified string of a Template Argument Type Supporting Stream Output
480 template< typename T >
481 inline
482 std::string
484  T const & t,
485  int const w, // Minimum width
486  char const f = ' ' // Fill character
487 )
488 {
489  std::ostringstream t_stream;
490  t_stream << std::right << std::uppercase
491  << std::setw( w ) << std::setfill( f ) << std::setprecision( TypeTraits< T >::precision() ) << t;
492  return t_stream.str();
493 }
494 
495 
496 /// @brief Leading-Zero Right-Justified string of a Template Argument Type Supporting Stream Output
497 /// @note Negative numbers appear with the minus sign on the left of the filled zeros
498 template< typename T >
499 inline
500 std::string
502  T const & t,
503  int const w // Minimum width
504 )
505 {
506  std::ostringstream t_stream;
507  t_stream << std::internal << std::uppercase
508  << std::setw( w ) << std::setfill( '0' ) << std::setprecision( TypeTraits< T >::precision() ) << t;
509  return t_stream.str();
510 }
511 
512 
513 /// @brief Right-Justified General Format string of a Template Argument Type Supporting Stream Output
514 template< typename T >
515 inline
516 std::string
518  T const & t,
519  int const w = TypeTraits< T >::width(), // Minimum width
520  int const p = TypeTraits< T >::precision() // Precision
521 )
522 {
523  std::ostringstream t_stream;
524  t_stream << std::right << std::uppercase << std::showpoint
525  << std::setw( w ) << std::setprecision( p ) << t;
526  return t_stream.str();
527 }
528 
529 
530 /// @brief Right-Justified Fixed Format string of a Template Argument Type Supporting Stream Output
531 template< typename T >
532 inline
533 std::string
535  T const & t,
536  int const w = TypeTraits< T >::width(), // Minimum width
537  int const p = TypeTraits< T >::precision() // Precision
538 )
539 {
540  std::ostringstream t_stream;
541  t_stream << std::right << std::uppercase << std::fixed << std::showpoint
542  << std::setw( w ) << std::setprecision( p ) << t;
543  return t_stream.str();
544 }
545 
546 
547 /// @brief Right-Justified Scientific Format string of a Template Argument Type Supporting Stream Output
548 template< typename T >
549 inline
550 std::string
552  T const & t,
553  int const w = TypeTraits< T >::width(), // Minimum width
554  int const p = TypeTraits< T >::precision() // Precision
555 )
556 {
557  std::ostringstream t_stream;
558  t_stream << std::right << std::uppercase << std::scientific << std::showpoint
559  << std::setw( w ) << std::setprecision( p ) << t;
560  return t_stream.str();
561 }
562 
563 
564 // Conversion From std::string
565 
566 
567 /// @brief string is Readable as a Type Supporting Stream Input?
568 template< typename T >
569 inline
570 bool
571 is_type( std::string const & s )
572 {
573  if ( is_whitespace( s ) ) { // Don't accept empty or whitespace string
574  return false;
575  } else { // Try to read the string as a T
576  std::istringstream t_stream( trimmed_whitespace( s ) );
577  T t;
578  t_stream >> t;
579  return ( ( t_stream ) && ( t_stream.eof() ) );
580  }
581 }
582 
583 
584 /// @brief string is Readable as a char Supporting Stream Input?
585 template<>
586 inline
587 bool
588 is_type< char >( std::string const & s )
589 {
590  return ( s.length() == 1 );
591 }
592 
593 
594 /// @brief string is Readable as a bool?
595 inline
596 bool
597 is_bool( std::string const & s )
598 {
599  return is_type< bool >( s );
600 }
601 
602 
603 /// @brief string is Readable as a short int?
604 inline
605 bool
606 is_short( std::string const & s )
607 {
608  return is_type< short int >( s );
609 }
610 
611 
612 /// @brief string is Readable as an int?
613 inline
614 bool
615 is_int( std::string const & s )
616 {
617  return is_type< int >( s );
618 }
619 
620 /// @brief string is Readable as ints? [e.g., "5" or "5-8"]
621 bool
622 is_ints( std::string const & s );
623 
624 /// @brief string is Readable as a long int?
625 inline
626 bool
627 is_long( std::string const & s )
628 {
629  return is_type< long int >( s );
630 }
631 
632 
633 /// @brief string is Readable as a unsigned short int?
634 inline
635 bool
636 is_ushort( std::string const & s )
637 {
638  return is_type< unsigned short int >( s );
639 }
640 
641 
642 /// @brief string is Readable as an unsigned int?
643 inline
644 bool
645 is_uint( std::string const & s )
646 {
647  return is_type< unsigned int >( s );
648 }
649 
650 
651 /// @brief string is Readable as a unsigned long int?
652 inline
653 bool
654 is_ulong( std::string const & s )
655 {
656  return is_type< unsigned long int >( s );
657 }
658 
659 
660 /// @brief string is Readable as a float?
661 inline
662 bool
663 is_float( std::string const & s )
664 {
665  return is_type< float >( s );
666 }
667 
668 
669 /// @brief string is Readable as a double?
670 inline
671 bool
672 is_double( std::string const & s )
673 {
674  return is_type< double >( s );
675 }
676 
677 
678 /// @brief string is Readable as a long double?
679 inline
680 bool
681 is_longdouble( std::string const & s )
682 {
683  return is_type< long double >( s );
684 }
685 
686 
687 /// @brief string is Readable as a char?
688 inline
689 bool
690 is_char( std::string const & s )
691 {
692  return is_type< char >( s );
693 }
694 
695 
696 /// @brief Type of a string for Type Supporting Stream Input
697 template< typename T >
698 inline
699 T
700 type_of( std::string const & s )
701 {
702  std::istringstream t_stream( trimmed_whitespace( s ) );
703  T t;
704  t_stream >> t;
705  return ( ( t_stream ) && ( t_stream.eof() ) ? t : T() ); // Check is_type first
706 }
707 
708 
709 /// @brief char of a string
710 template<>
711 inline
712 char
713 type_of< char >( std::string const & s )
714 {
715  return ( s.length() == 1 ? s[ 0 ] : char() ); // Check is_type first
716 }
717 
718 
719 /// @brief short int of a string
720 inline
721 short int
722 short_of( std::string const & s )
723 {
724  return type_of< short int >( s );
725 }
726 
727 
728 /// @brief int of a string
729 inline
730 int
731 int_of( std::string const & s )
732 {
733  return type_of< int >( s );
734 }
735 
736 /// @brief ints of a string (e.g., allowing "5-8" to represent "5 6 7 8")
737 std::vector< int >
738 ints_of( std::string const & s );
739 
740 
741 /// @brief ints of a string (e.g., allowing "5-8" to represent "5 6 7 8")
742 std::vector< int >
743 ints_of( std::string const & s, bool & string_is_ok );
744 
745 
746 /// @brief long int of a string
747 inline
748 long int
749 long_of( std::string const & s )
750 {
751  return type_of< long int >( s );
752 }
753 
754 
755 /// @brief unsigned short int of a string
756 inline
757 unsigned short int
758 ushort_of( std::string const & s )
759 {
760  return type_of< unsigned short int >( s );
761 }
762 
763 
764 /// @brief unsigned int of a string
765 inline
766 unsigned int
767 uint_of( std::string const & s )
768 {
769  return type_of< unsigned int >( s );
770 }
771 
772 
773 /// @brief unsigned long int of a string
774 inline
775 unsigned long int
776 ulong_of( std::string const & s )
777 {
778  return type_of< unsigned long int >( s );
779 }
780 
781 
782 /// @brief float of a string
783 inline
784 float
785 float_of( std::string const & s )
786 {
787  return type_of< float >( s );
788 }
789 
790 
791 /// @brief double of a string
792 inline
793 double
794 double_of( std::string const & s )
795 {
796  return type_of< double >( s );
797 }
798 
799 
800 /// @brief long double of a string
801 inline
802 long double
803 longdouble_of( std::string const & s )
804 {
805  return type_of< long double >( s );
806 }
807 
808 
809 /// @brief char of a string
810 inline
811 char
812 char_of( std::string const & s )
813 {
814  return type_of< char >( s );
815 }
816 
817 
818 } // namespace ObjexxFCL
819 
820 
821 #endif // INCLUDED_ObjexxFCL_string_functions_HH
std::string fixed_string_of(T const &t, int const w=TypeTraits< T >::width(), int const p=TypeTraits< T >::precision())
Right-Justified Fixed Format string of a Template Argument Type Supporting Stream Output...
bool not_blank(char const c)
Character is Not Blank?
std::string & size(std::string &s, std::string::size_type const len)
Size a string to a Specified Length.
char lowercased(char const c)
Lowercased Copy of a Character.
bool has_suffix(std::string const &s, std::string const &suf, bool const exact_case)
Has a Suffix Case-Optionally?
unsigned long int ulong_of(Fstring const &s)
unsigned long int of an Fstring
Definition: Fstring.hh:2844
std::string lead_zero_string_of(T const &t, int const w)
Leading-Zero Right-Justified string of a Template Argument Type Supporting Stream Output...
T type_of(Fstring const &s)
Type of an Fstring for Type Supporting Stream Input.
Definition: Fstring.hh:2767
bool is_short(Fstring const &s)
Fstring is Readable as a short int?
Definition: Fstring.hh:2667
std::string scientific_string_of(T const &t, int const w=TypeTraits< T >::width(), int const p=TypeTraits< T >::precision())
Right-Justified Scientific Format string of a Template Argument Type Supporting Stream Output...
bool is_blank(char const c)
Character is Blank?
std::string stripped_whitespace(std::string const &s)
Whitespace Stripped from a string's Tails Copy of a string.
std::string blank(std::string::size_type const len)
Blank string of Specified Length.
unsigned short int ushort_of(Fstring const &s)
unsigned short int of an Fstring
Definition: Fstring.hh:2826
std::string & strip_whitespace(std::string &s)
Strip Whitespace from a string's Tails.
std::string & trim_whitespace(std::string &s)
Trim Trailing Whitespace from a string.
bool is_whitespace(std::string const &s)
string is Whitespace?
cmplx w(cmplx z, double relerr)
Definition: functions.cc:470
char * cstring
Definition: Cstring.hh:35
std::string general_string_of(T const &t, int const w=TypeTraits< T >::width(), int const p=TypeTraits< T >::precision())
Right-Justified General Format string of a Template Argument Type Supporting Stream Output...
bool is_bool(Fstring const &s)
Fstring is Readable as a bool?
Definition: Fstring.hh:2658
std::string & overlay(std::string &s, std::string const &t, std::string::size_type const pos)
Overlay a string With Another string, Expanding Size as Needed.
std::string rstripped(std::string const &s, std::string const &chars)
Specified Characters Stripped from a string's Right Tail Copy of a string.
bool has(std::string const &s, std::string const &t)
string has a string?
bool has_prefix(std::string const &s, std::string const &pre, bool const exact_case)
Has a Prefix Case-Optionally?
char type_of< char >(Fstring const &s)
char of an Fstring
Definition: Fstring.hh:2790
char & lowercase(char &c)
Lowercase a Character.
TypeTraits: Type Traits Template.
Definition: TypeTraits.hh:23
bool is_longdouble(Fstring const &s)
Fstring is Readable as a long double?
Definition: Fstring.hh:2739
long double longdouble_of(Fstring const &s)
long double of an Fstring
Definition: Fstring.hh:2871
std::string & lstrip_whitespace(std::string &s)
Strip Whitespace from a string's Left Tail.
Fstring::size_type len(Fstring const &s)
Length.
Definition: Fstring.hh:2207
bool is_ints(std::string const &s)
ints of a string (e.g., allowing "5-8" to represent "5 6 7 8").
bool is_char(Fstring const &s)
Fstring is Readable as a char?
Definition: Fstring.hh:2748
char const * c_cstring
bool equali(char const c, char const d)
char == char Case-Insensitively
std::string & rstrip_whitespace(std::string &s)
Strip Whitespace from a string's Right Tail.
std::string right_string_of(T const &t, int const w, char const f= ' ')
Right-Justified string of a Template Argument Type Supporting Stream Output.
std::string padded(std::string const &s, std::string::size_type const len)
Padded to a Specified Length Copy of a string.
long int long_of(Fstring const &s)
long int of an Fstring
Definition: Fstring.hh:2817
bool is_uint(Fstring const &s)
Fstring is Readable as an unsigned int?
Definition: Fstring.hh:2703
tuple p
Definition: docking.py:9
std::string & pad(std::string &s, std::string::size_type const len)
Pad a string to a Specified Length.
std::string & strip(std::string &s, std::string const &chars)
Strip Specified Characters from a string's Tails.
std::string head(std::string const &s)
Space-Free Head Copy of a string.
std::string trimmed_whitespace(std::string const &s)
Trailing Whitespace Trimmed Copy of a string.
std::string rpadded(std::string const &s, std::string::size_type const len)
Right-Padded to a Specified Length Copy of a string.
bool equal(char const c, char const d, bool const exact_case)
char == char Case-Optionally?
std::string & trim(std::string &s)
Trim Trailing Space from a string.
std::string left_string_of(T const &t, int const w, char const f= ' ')
Left-Justified string of a Template Argument Type Supporting Stream Output.
Fstring::size_type len_trim(Fstring const &s)
Length Space-Trimmed.
Definition: Fstring.hh:2216
std::string & lpad(std::string &s, std::string::size_type const len)
Left-Pad a string to a Specified Length.
std::string uniqued(std::string const &s)
Removed Repeat Characters from a Possibly Unsorted string Preserving Order Copy of a string...
std::string & unique(std::string &s)
Remove Repeat Characters from a Possibly Unsorted string Preserving Order.
std::string left_justified(std::string const &s)
Left-Justified Copy of a string.
bool not_whitespace(std::string const &s)
string is Not Whitespace?
std::string & rpad(std::string &s, std::string::size_type const len)
Right-Pad a string to a Specified Length.
std::string & lstrip(std::string &s, std::string const &chars)
Strip Specified Characters from a string's Left Tail.
bool is_type< char >(Fstring const &s)
Fstring is Readable as a char Supporting Stream Input?
Definition: Fstring.hh:2649
bool is_ushort(Fstring const &s)
Fstring is Readable as a unsigned short int?
Definition: Fstring.hh:2694
bool is_type(Fstring const &s)
Fstring is Readable as a Type Supporting Stream Input?
Definition: Fstring.hh:2622
std::vector< int > ints_of(std::string const &s)
ints of a string (e.g., allowing "5-8" to represent "5 6 7 8").
unsigned int uint_of(Fstring const &s)
unsigned int of an Fstring
Definition: Fstring.hh:2835
std::string stripped(std::string const &s, std::string const &chars)
Specified Characters Stripped from a string's Tails Copy of a string.
bool is_int(Fstring const &s)
Fstring is Readable as an int?
Definition: Fstring.hh:2676
float float_of(Fstring const &s)
float of an Fstring
Definition: Fstring.hh:2853
std::string lpadded(std::string const &s, std::string::size_type const len)
Left-Padded to a Specified Length Copy of a string.
std::string::size_type len_trim_whitespace(std::string const &s)
Length Whitespace-Trimmed.
std::string centered(std::string const &s)
Centered wrt Whitespace Copy of a string.
bool is_long(Fstring const &s)
Fstring is Readable as a long int?
Definition: Fstring.hh:2685
Fstring center(Fstring const &s)
Centered Copy.
Definition: Fstring.hh:2431
std::string & right_justify(std::string &s)
Right Justify a string.
std::string rstripped_whitespace(std::string const &s)
Whitespace Stripped from a string's Right Tail Copy of a string.
int int_of(Fstring const &s)
int of an Fstring
Definition: Fstring.hh:2808
bool has_any_of(Fstring const &s, Fstring const &t)
Fstring Has Any Characters of a Set?
Definition: Fstring.hh:2294
std::string lstripped(std::string const &s, std::string const &chars)
Specified Characters Stripped from a string's Left Tail Copy of a string.
Fstring trimmed(Fstring const &s)
Space-Trimmed Copy.
Definition: Fstring.hh:2225
std::string string_of(Fstring const &s)
string of an Fstring
Definition: Fstring.hh:2889
bool is_ulong(Fstring const &s)
Fstring is Readable as a unsigned long int?
Definition: Fstring.hh:2712
std::string & rstrip(std::string &s, std::string const &chars)
Strip Specified Characters from a string's Right Tail.
std::string sized(std::string const &s, std::string::size_type const len)
Sized to a Specified Length Copy of a string.
char uppercased(char const c)
Uppercased Copy of a Character.
char & uppercase(char &c)
Uppercase a Character.
std::string right_justified(std::string const &s)
Right-Justified Copy of a string.
char char_of(Fstring const &s)
char of an Fstring
Definition: Fstring.hh:2880
std::string lstripped_whitespace(std::string const &s)
Whitespace Stripped from a string's Left Tail Copy of a string.
std::string & left_justify(std::string &s)
Left Justify a string.
double double_of(Fstring const &s)
double of an Fstring
Definition: Fstring.hh:2862
bool is_double(Fstring const &s)
Fstring is Readable as a double?
Definition: Fstring.hh:2730
short int short_of(Fstring const &s)
short int of an Fstring
Definition: Fstring.hh:2799
bool is_float(Fstring const &s)
Fstring is Readable as a float?
Definition: Fstring.hh:2721