{ Snipperize } /string
Snippets about string
in-place stream formatting
void f( std::string const & ); void g( const char* ); f( make_string() << "Say hi" ); // works ok g( make_string() << "Bye" ); // kills the application g( (make_string() << "Hi again").c_str() ); // ok again std::string temporary is alive until g() returns
C++ / make_string, string, cstring, iostream / by ThePeppersStudio (9 days, 17.07 hours ago)
Fastest vs Easiest way to read a full file into a std::string.
Fastest vs Easiest way to read a full file into a std::string.
C++ / fastest, easiest, iostream, string, file / by ThePeppersStudio (9 days, 17.18 hours ago)
Reverse a string including unicode combining characters
Example: >>> ucode = ''.join( chr(int(n, 16)) for n in ['61', '73', '20dd', '64', '66', '305'] ) >>> ucoderev = ureverse(ucode) >>> ['%x' % ord(char) for char in ucoderev] ['66', '305', '64', '73', '20dd', '61'] >>>
Python / unicode, string, reverse / by ThePeppersStudio (80 days, 22.41 hours ago)
Trim Function for String in C++
The main() is just for testing the function, let's see how it went. $ gcc -Wall -o go trim.c $ ./go s = 'srikanth s' empty = '' newline = '' double_newline = '' single_char = 's' This function doesn't create a new char[] for the trimmed string, it modifies the original. Let me know if you've got an optimized version than this, I'll be interested to learn.
C++ / trim, string / by ThePeppersStudio (94 days, 19.05 hours ago)
Convert String To ASCII
避免多语言编码问题
PHP / convert, string, ascii / by ThePeppersStudio (114 days, 17.63 hours ago)
Format string as machine compatible key
This snippet converts a "dirty" string that may contain special characters into a machine compatible nice looking string. That function works fine for creating urls or ID keys.
PHP / url, string, convert / by ThePeppersStudio (154 days, 1.77 hours ago)
MD5-based block cipher
MD5-based block cipher (MDC-like), which works in 128bit CFB mode. It is very useful to encrypt secret data before transfer it over the network.
PHP / encrypt, string, cipher, md5 / by ThePeppersStudio (154 days, 1.81 hours ago)
正则删除重复字符串
利用正则表达式删除重复字符串
PHP / preg_replace, 正则表达式, 重复, repleat, string / by ThePeppersStudio (160 days, 15.53 hours ago)
Convert Hex to Str/Convert Str to Hex
convert a string to it's hex representation and back
PHP / convert, hex, string / by ThePeppersStudio (196 days, 16.76 hours ago)
NSString Contains String Additions
Objective-C / NSString, string, substring / by ThePeppersStudio (230 days, 23.48 hours ago)
- Home
- New Snippet
- Languages
-

