Important facts about commercial licenses

  • Licenses are perpetual. They do not expire and do not need to be renewed.
  • Licenses can be upgraded. You can upgrade to a more expensive license later paying only the difference in cost.
  • Pay attention to the distribution type - Hosted (sites / servers), binary (applications) or source (includes all the others). Choose according to your needs (more below).
  • All licenses allow commercial use unless otherwise indicated.
  • Read the full license by clicking on the icon.
  • Read more about licenses in our handy license guide.
Free

Personal License

1 application Binary restricted distribution Non-commercial use only
You need to log-in or create an account
  • Create an account
  • Log-in
  • Please use your real name.
  • Account activation link will be sent to this address.
  • Minimum 8 characters

Clicking this button confirms you read and agreed to the terms of use and privacy policy.

(2 ratings)

String converter

String converter
Developed by vincenzo panella, Released Aug 8, 2011

This library converts various formats into strings and vice versa

C/C++

Tags: bin , binary , conversion , converter

This library is written for converting numeric formats into string and for doing the opposite. The library is of a static type, everything is included in a single header file and is very easy to include in any project - the only requirements are the inclusion of the stl libraries. Every function is templated to work with every kind of numeric formats.

Some examples:

string a=CStringConverter::NumToString( num, std::fixed, 10 );

Converts a number expressed in fixed form with a precision of 10 digits.

float a=CStringConverter::NumToString( numstring, std::fixed, 10 );

Similar to the above with different type.

Quick conversion functions:

double a=CStringConveter::StringToDouble( numstring );
float a=CStringConveter::StringToDouble( numstring );
string a =CStringConverter::DecToBinStr( n );

Converts a decimal number into a binary string.

string a =CStringConverter::DecToHexStr( n );

Converts a decimal number into an hexadecimal string.

int a =CStringConverter::HexToDecStr( numstr );

Reverse of the above.

string a = CStringConverter::DateToStr();

Converts the current date into a string.

RGB rgb=CStringConverter::HexStrToRGB( numstring );

Converts an hexadecimal color value into an RGB triple, the RGB data structure is included in the library.

string a=CStringConverter::RgbToHex( r,g,b );

Reverse of the above function.

int a=CStringConverter::OctToDec( num );

Converts an octal number into decimal.

int a=CStringConverter::DecToOct( num );

Reverse of the above function.

The library has been updated to include different classes most of them are documented well enough to put inside any existing code without much problems the classes are : string validator class , which tests if s given string is a numeric format , included there is also a function for computing the similarity of two strings. string formatter class which eliminates whites, trailing spaces and other string normalizing functions split path class, given a full path , separates directories, filenames and extensions I have also include the message error handling class which was missing in the previous version

View all 2 reviews »

User Reviews

  • Sameera Chathuranga Abeywickrama 1 year ago
    Well commented and readable
    Flag
    Was this helpful? Yes No
  • Felix Bytow 11 months ago
    The only good point I could find was the documentation... (Though this could have been even better with doxygen :-) )

    The code is far from being usable with an undefined CMessage class which is used for error handling in the library but has neither a declaration nor a definition...
    Also it uses the MultiByteToWideChar function which would require windows.h to be included... which is not included...

    There are some modern C++ style issues as well... (<time.h> instead of the correct <ctime>, typedefs for structs which are unneccessary in C++, a class which is against all principles of OOP... CStringConverter should rather have been a namespace)
    Flag
    Was this helpful? Yes No
Read all 1 comments »

Questions & Comments


Or enter your name and Email
  • vincenzo panella Author 11 months ago
    Will work on this code an put a newer version as soon as possible, thanks for your comments
You must be logged-in to vote. Log-in to your account or register now.