Original Post
ok this is the string the i read from a file: graphic_api = d3d; and when i want to take out just the: d3d no spaces and no ';' this is the code i use: but for some reason, this is what is returned: " d3d" i don't know why the space is there. how could i change my code to get that space out? i have tried a -1 and +1 everywhere i can think of but i am for some reason not getting it. the only way to fix it that i can find it to add some code but i would rather not have that, it adds time to process and even tho it is time critcal function i like it to be as fast possiable.
std::string CConfigDatabase::GetValueFromString( const std::string & oringal_string )
{
// position of start and end of where the value is located in the string
std::string::size_type position_0 = oringal_string.find_first_of( key_value_delim ) + 1;
std::string::size_type position_1 = oringal_string.find_last_of( comment_delim );
// Return the value part of the string, anything to right right of the "=" sign and to the left of the ";" sign
return oringal_string.substr( position_0, position_1 - position_0 );