ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/gclib/tophat_cpp/GStr.cpp
(Generate patch)
# Line 353 | Line 353
353   bool GStr::contains(char c) const {
354   return (index(c, 0) >= 0);
355   }
356 +
357   GStr& GStr::format(const char *fmt,...) {
358   // Format as in sprintf
359    make_unique(); //edit operation ahead
# Line 671 | Line 672
672      return newstring;
673   }
674  
675 + GStr& GStr::reverse() {
676 +  make_unique();
677 +  int l=0;
678 +  int r=my_data->length-1;
679 +  char c;
680 +  while (l<r) {
681 +     c=my_data->chars[l];
682 +     my_data->chars[l]=my_data->chars[r];
683 +     my_data->chars[r]=c;
684 +     l++;r--;
685 +     }
686 +  return *this;
687 + }
688 +
689  
690   //transform: any character from 'from' is replaced with a coresponding
691   //char from 'to'

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines