1
2
3
def rot_encode(s, offset=2)
   s.split('').map{ |char| (char.ord + offset).chr }.join
end  

Ruby rot encode

by Sam Figueroa, January 17, 2010 11:44, 5 refactorings, tagged with rot, rotation, encode, strings

Rotation encoding with vari...

45596033957b2b6d7ef8fe6545e0b7e7 Talk
1
2
3
4
package engine;

import junit.framework.Assert;
...

Java Refactor, fix and optimize ...

by programmer-offsite, April 20, 2009 14:15, 3 refactorings, tagged with optimize, strings, refactor, java, character

While tuning the applicatio...

6f0a7377a1c0faa24f9b60e24ab2af4a Talk
1
2
3
4
char **split (char *string, char sep, char escape) {

    char **ret = NULL;
...

C A Java-like function split

by Fran, September 16, 2008 08:32, 3 refactorings, tagged with c, split, strings

This function splits a stri...

3c50320adac71693cef577a5dbd3d4d4 Talk
1
2
3
4
data = data.gsub("\xA0", " ")
data = data.gsub("\x99", "(TM)")
data = data.gsub("\x97", "-")
...

Ruby simplify multiple gsub

by kenr, August 27, 2008 01:10, 11 refactorings, tagged with strings

I could put the search/repl...

60997be4fbb4f5719d6eb68a1eadee9a Talk