Botan

Various string utils and  parsing functions

License
Botan is released under the Simplified BSD License (see LICENSE.md)

Vector!string  parseAlgorithmName(in string scan_name);

Parse a SCAN-style algorithm name

Parameters
string scan_name the name
Returns
the name components

Vector!string  splitter(in string str, char delim);

Split a string

Parameters
string str the input string
char delim the delimitor
Returns
string split by delim

Vector!string  splitOnPred(in string str, bool delegate(char) pred);

Split a string on a character predicate

Parameters
string str the input string
bool delegate(char) pred the predicate that returns true to split

string  eraseChars(in string str, in char[] chars);

Erase characters from a string


string  replaceChar(in string str, in char from_char, in char to_char);

Replace a character in a string

Parameters
string str the input string
char from_char the character to replace
char to_char the character to replace it with
Returns
str with all instances of from_char replaced by to_char

string  replaceChars(in string str, in char[] chars, in char to_char);

Replace a character in a string

Parameters
string str the input string
char[] chars the characters to replace
char to_char the character to replace it with
Returns
str with all instances of chars replaced by to_char

string  stringJoin(ref const Vector!string strs, char delim);

Join a string

Parameters
Vector!string strs strings to join
char delim the delimitor
Returns
string joined by delim

Vector!uint  parseAsn1Oid(in string oid);

Parse an ASN.1 OID

Parameters
string oid the OID in string form
Returns
OID components

bool  x500NameCmp(in string name1, in string name2);

Compare two names using the X.509 comparison algorithm

Parameters
string name1 the first name
string name2 the second name
Returns
true if name1 is the same as name2 by the X.509 comparison rules

uint  stringToIpv4(in string str);

Convert a string representation of an IPv4 address to a number

Parameters
string str the string representation
Returns
integer IPv4 address

string  ipv4ToString(uint ip);

Convert an IPv4 address to a string

Parameters
uint ip the IPv4 address to convert
Returns
string representation of the IPv4 address