{ Snipperize } /string

Snippets about string

Here are the latest snippets talking about string. Please choose your favorite one or add a new one.

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 (1 days, 1.31 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 (1 days, 1.41 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 (72 days, 6.65 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 (86 days, 3.29 hours ago)

Convert String To ASCII

避免多语言编码问题

PHP / convert, string, ascii / by ThePeppersStudio (106 days, 1.86 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 (145 days, 10.01 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 (145 days, 10.04 hours ago)

正则删除重复字符串

利用正则表达式删除重复字符串

PHP / preg_replace, 正则表达式, 重复, repleat, string / by ThePeppersStudio (151 days, 23.77 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 (188 days, 0.99 hours ago)

NSString Contains String Additions

Objective-C / NSString, string, substring / by ThePeppersStudio (222 days, 7.71 hours ago)