Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3327 for code/trunk/src/util


Ignore:
Timestamp:
Jul 19, 2009, 5:31:02 PM (15 years ago)
Author:
rgrieder
Message:

Merged all remaining revisions from core4 back to the trunk.

Location:
code/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/util/StringUtils.cc

    r3301 r3327  
    490490        return std::string::npos;
    491491    }
     492
     493    /**
     494        @brief Replaces individual charaters
     495        @param str String to be manipulated
     496        @param target Character to be replaced
     497        @param replacement Replacement character
     498        @return Number of replacements
     499    */
     500    _UtilExport size_t replaceCharacters(std::string& str, char target, char replacement)
     501    {
     502        size_t j = 0;
     503        for (size_t i = 0; i < str.size(); ++i)
     504        {
     505            if (str[i] == target)
     506            {
     507                str[i] = replacement;
     508                ++j;
     509            }
     510        }
     511        return j;
     512    }
    492513}
  • code/trunk/src/util/StringUtils.h

    r3280 r3327  
    7777    _UtilExport size_t      getCommentPosition(const std::string& str);
    7878    _UtilExport size_t      getNextCommentPosition(const std::string& str, size_t start = 0);
     79
     80    _UtilExport size_t      replaceCharacters(std::string& str, char target, char replacement);
    7981}
    8082
Note: See TracChangeset for help on using the changeset viewer.