This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Collections.Generic; | |
| using System.Text; | |
| namespace Mickey.Utils | |
| { | |
| /// <summary> | |
| /// 字符串编码/解码 | |
| /// </summary> | |
| public static class StringEncoder | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * StringUtil | |
| * | |
| * @author mickey | |
| * @version 1.0 | |
| * @package Utility | |
| */ | |
| final class StringUtil | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'digest/md5' | |
| module Shorten | |
| #base32 | |
| TABLE = %w(a b c d e f g h i j k l m n o p q r s t u v w x y z 2 3 4 6 7 8) | |
| # short('balabala') => Array | |
| # short('balabala',1) => String, Array[1] | |
| def self.short long_str, index = nil | |
| index = (0..3).to_a.include?(index) ? index : nil | |
| hash_string = Digest::MD5.hexdigest(long_str) |
NewerOlder