C++ API Library Reference  4.3.2-74-ge1d4cca
Public Static Functions | List of all members
Ascii Class Reference

The Ascii class is a static class for performing operations on ASCII strings.

Public Static Functions

template<typename T >
static T AsFloat (char const *value)
 
template<typename T >
static T AsFloat (String const &value)
 
template<typename T >
static T AsInteger (char const *value, Radix::Value radix=Radix::Decimal)
 
template<typename T >
static T AsInteger (String const &value, Radix::Value radix=Radix::Decimal)
 
static int CompareOrdinal (char const *pLeft, char const *pRight, SizeType count=Everything)
 
static int CompareOrdinal (String const &left, char const *pRight, SizeType count=Everything)
 
static int CompareOrdinal (char const *pLeft, String const &right, SizeType count=Everything)
 
static bool Equal (char const &left, char const &right)
 
static char const * Find (char const *pStart, char element, SizeType count=Everything)
 
static String Format (char const *format,...)
 
template<size_t size>
static bool FormatBuffer (char(&buffer)[size], char const *format,...)
 
static String FromFloat (Float64 value)
 
static String FromFloat (Float32 value)
 
static AsciiArray FromFloatAscii (Float64 value)
 
static AsciiArray FromFloatAscii (Float32 value)
 
template<typename T >
static String FromInteger (T value, Radix::Value radix=Radix::Decimal)
 
template<typename T >
static AsciiArray FromIntegerAscii (T value, Radix::Value radix=Radix::Decimal)
 
static HashCode GetHashCode (char const *pString, SizeType count=Everything)
 
static bool IsNullOrEmpty (char const *p)
 
static SizeType Length (char const *p)
 
static SizeType Parse (String const &source, char const *format,...)
 
static SizeType ParseBuffer (char const *buffer, char const *format,...)
 
template<typename T >
static bool TryParseFloat (char const *value, T &result)
 
template<typename T >
static bool TryParseFloat (String const &value, T &result)
 
template<typename T >
static bool TryParseInteger (char const *value, T &result, Radix::Value radix=Radix::Decimal)
 
template<typename T >
static bool TryParseInteger (String const &value, T &result, Radix::Value radix=Radix::Decimal)
 
static String VFormat (char const *format, va_list args)
 
static SizeType VParse (String const &source, char const *format, va_list args)
 
static SizeType VParseBuffer (char const *buffer, char const *format, va_list args)
 

Usage Description

static T AsFloat ( char const *  value)
inlinestatic

Gets the value as the specified type. If the value of this instance cannot be converted, a FormatException will be thrown. Assumes that the string contains a number using ASCII invariant encoding.

static T AsFloat ( String const &  value)
inlinestatic

Gets the value as the specified type. If the value of this instance cannot be converted, a FormatException will be thrown. Assumes that the string contains a number using ASCII invariant encoding.

static T AsInteger ( char const *  value,
Radix::Value  radix = Radix::Decimal 
)
inlinestatic

Gets the value as the specified type. If the value of this instance cannot be converted, a FormatException will be thrown. Assumes that the string contains a number using ASCII invariant encoding, in the specified radix.

static T AsInteger ( String const &  value,
Radix::Value  radix = Radix::Decimal 
)
inlinestatic

Gets the value as the specified type. If the value of this instance cannot be converted, a FormatException will be thrown. Assumes that the string contains a number using ASCII invariant encoding, in the specified radix.

static int CompareOrdinal ( char const *  pLeft,
char const *  pRight,
SizeType  count = Everything 
)
static
static int CompareOrdinal ( String const &  left,
char const *  pRight,
SizeType  count = Everything 
)
static
static int CompareOrdinal ( char const *  pLeft,
String const &  right,
SizeType  count = Everything 
)
static
static bool Equal ( char const &  left,
char const &  right 
)
inlinestatic

Returns a boolean value that indicates whether the two specified strings are the same.

static char const* Find ( char const *  pStart,
char  element,
SizeType  count = Everything 
)
static
static String Format ( char const *  format,
  ... 
)
inlinestatic

Returns a formatted string as a String, using C-runtime ASCII-based formatting. The format parameter follows the same formatting conventions as the printf family of functions in the C runtime library. The maximum length of string that will be returned is 16384 characters.

static bool FormatBuffer ( char(&)  buffer[size],
char const *  format,
  ... 
)
inlinestatic

Formats a C-runtime ASCII string into the specified ASCII buffer. The format parameter follows the same formatting conventions as the printf family of functions in the C runtime library. The buffer is guaranteed to be null terminated on return. Returns false if the formatting failed because of an error, or because the buffer was too small.

static String FromFloat ( Float64  value)
inlinestatic

Gets a string representation of a floating point number. All digits are encoded in ASCII invariant encoding.

static String FromFloat ( Float32  value)
inlinestatic

Gets a string representation of a floating point number. All digits are encoded in ASCII invariant encoding.

static AsciiArray FromFloatAscii ( Float64  value)
inlinestatic

Gets an ASCII string representation of a floating point number. The returned array has a NULL terminator in the underlying storage, but the null is not included in bounds of array.

static AsciiArray FromFloatAscii ( Float32  value)
inlinestatic

Gets an ASCII string representation of a floating point number. The returned array has a NULL terminator in the underlying storage, but the null is not included in bounds of array.

static String FromInteger ( value,
Radix::Value  radix = Radix::Decimal 
)
inlinestatic

Gets a string representation of an integer in the specified radix. All digits are encoded in ASCII invariant encoding.

static AsciiArray FromIntegerAscii ( value,
Radix::Value  radix = Radix::Decimal 
)
inlinestatic

Gets an ASCII string representation of an integer in the specified radix. The returned array has a NULL terminator in the underlying storage, but the null is not included in bounds of array.

static HashCode GetHashCode ( char const *  pString,
SizeType  count = Everything 
)
static

Returns the specified string, expressed as a hashcode.

static bool IsNullOrEmpty ( char const *  p)
inlinestatic

Returns a boolean value that indicates whether the specified string is null or empty.

static SizeType Length ( char const *  p)
inlinestatic

Returns the length of the string.

static SizeType Parse ( String const &  source,
char const *  format,
  ... 
)
inlinestatic

Parses a formatted string, using C-runtime ASCII-based formatting. The source string is converted to ASCII before parsing occurs; any non-ASCII characters will be converted to underscores ('_'). The format parameter follows the same formatting conventions as the sscanf family of functions in the C runtime library. Returns the number of argument succesfully converted. Invalid is returned if an error occurs.

static SizeType ParseBuffer ( char const *  buffer,
char const *  format,
  ... 
)
inlinestatic

Parses a formatted string from a buffer. The format parameter follows the same formatting conventions as the sscanf family of functions in the C runtime library. Returns the number of argument succesfully converted. Invalid is returned if an error occurs.

static bool TryParseFloat ( char const *  value,
T &  result 
)
inlinestatic

Tries to convert the current string to a floating point number. Assumes that the string contains a number using ASCII invariant encoding.

static bool TryParseFloat ( String const &  value,
T &  result 
)
inlinestatic

Tries to convert the current string to a floating point number. Assumes that the string contains a number using ASCII invariant encoding.

static bool TryParseInteger ( char const *  value,
T &  result,
Radix::Value  radix = Radix::Decimal 
)
inlinestatic

Tries to convert the current string to an integral number with the specified radix of the specified type. Assumes that the string contains a number using ASCII invariant encoding, in the specified radix.

static bool TryParseInteger ( String const &  value,
T &  result,
Radix::Value  radix = Radix::Decimal 
)
inlinestatic

Tries to convert the current string to an integral number with the specified radix of the specified type. Assumes that the string contains a number using ASCII invariant encoding, in the specified radix.

static String VFormat ( char const *  format,
va_list  args 
)
static

Returns a formatted string, using C-runtime ASCII-based formatting. The format parameter follows the same formatting conventions as the vprintf family of functions in the C runtime library. The maximum length of string that will be returned is 16384 characters.

static SizeType VParse ( String const &  source,
char const *  format,
va_list  args 
)
static

Parses a formatted string, using C-runtime ASCII-based formatting. The source string is converted to ASCII before parsing occurs; any non-ASCII characters will be converted to underscores ('_'). The format parameter follows the same formatting conventions as the sscanf family of functions in the C runtime library. Returns the number of argument succesfully converted. Invalid is returned if an error occurs.

static SizeType VParseBuffer ( char const *  buffer,
char const *  format,
va_list  args 
)
inlinestatic

Parses a formatted string from a buffer, using C-runtime ASCII-based formatting. The format parameter follows the same formatting conventions as the sscanf family of functions in the C runtime library. Returns the number of argument succesfully converted. Invalid is returned if an error occurs.