feisty meow concerns codebase  2.140
string_manipulation.h
Go to the documentation of this file.
1 #ifndef STRING_MANIPULATION_CLASS
2 #define STRING_MANIPULATION_CLASS
3 
4 /*****************************************************************************\
5 * *
6 * Name : string_manipulation *
7 * Author : Chris Koeritz *
8 * *
9 *******************************************************************************
10 * Copyright (c) 2000-$now By Author. This program is free software; you can *
11 * redistribute it and/or modify it under the terms of the GNU General Public *
12 * License as published by the Free Software Foundation; either version 2 of *
13 * the License or (at your option) any later version. This is online at: *
14 * http://www.fsf.org/copyleft/gpl.html *
15 * Please send any updates to: fred@gruntose.com *
16 \*****************************************************************************/
17 
18 #include <basis/astring.h>
19 
20 namespace textual {
21 
23 
25 {
26 public:
27 
29 
30  static basis::astring make_random_name(int min = 1, int max = 64);
32 
36 
37  static basis::astring long_line(char line_item = '/', int repeat = 76);
39 
43  static basis::astring indentation(int spaces);
45 
47 
48  static void carriage_returns_to_spaces(basis::astring &to_strip);
50 
55 
56  static void split_lines(const basis::astring &input, basis::astring &output,
57  int min_column = 0, int max_column = 79);
59 
64 
65  // numerical manipulation functions:
66 
67  static basis::abyte char_to_hex(char to_convert);
69 
70  static char hex_to_char(basis::abyte to_convert);
72 
73  static basis::byte_array string_to_hex(const basis::astring &character_form);
75 
79  static basis::astring hex_to_string(const basis::byte_array &byte_form);
81 
83 };
84 
85 } //namespace.
86 
87 #endif
88 
Provides a dynamically resizable ASCII character string.
Definition: astring.h:35
A very common template for a dynamic array of bytes.
Definition: byte_array.h:36
Provides various functions for massaging strings.
static char hex_to_char(basis::abyte to_convert)
Converts a byte between 0 and 15 into a corresponding hexadecimal character.
static basis::byte_array string_to_hex(const basis::astring &character_form)
Turns a string form of a set of hex numbers into an array of bytes.
static void split_lines(const basis::astring &input, basis::astring &output, int min_column=0, int max_column=79)
formats blocks of text for a maximum width.
static basis::astring long_line(char line_item='/', int repeat=76)
produces a long line of "line_item" characters.
static void carriage_returns_to_spaces(basis::astring &to_strip)
converts carriage returns in "to_strip" into spaces.
static basis::astring hex_to_string(const basis::byte_array &byte_form)
The inverse of string_to_hex prints "byte_form" as text.
static basis::astring make_random_name(int min=1, int max=64)
creates a random name, where the letters are between 'a' and 'z'.
static basis::abyte char_to_hex(char to_convert)
Converts a single character into the corresponding hex nibble.
static basis::astring indentation(int spaces)
Returns a string made of white space that is "spaces" long.
unsigned char abyte
A fairly important unit which is seldom defined...
Definition: definitions.h:51