Zarby
A library to Manipulate String with utiles methods.
Installation
Run:
bundle add zarby
Or install it yourself as:
$ gem install zarby
Usage
Three module are available: CSV, Normelize And Anonymize
CSV
Method do detecte delimiter in csv!
Since V 0.1.6 (depreciated and removed on 10/2024)
Zarby::CSV.detect_delimiter("aa,bb,cc")
Zarby::CSV.detect_delimiter("aa;bb;cc")
Zarby::CSV.detect_delimiter("aa,bb;cc,dd")
Zarby::CSV.detect_delimiter("aa;bb;cc,dd")
Since V 0.1.7
Zarby.detect_delimiter("aa,bb,cc")
Zarby.detect_delimiter("aa;bb;cc")
Zarby.detect_delimiter("aa,bb;cc,dd")
Zarby.detect_delimiter("aa;bb;cc,dd")
detect_delimiter
, render the dilimter, define in a csv on XXXX ms.
[',', ';', ':', '|']
, is available by default.
Normelize
Method to utf8 encode all caracters in a string (since widows , sweden enoding, etc ...).
Since V 0.1.6 (depreciated and removed on 10/2024)
Zarby.utf8("Aa\xFCAa\xDF".force_encoding('Windows-1252'))
Zarby::Normalize.utf8("Aa\xFCAa\xDF".force_encoding('ASCII-8BIT'))
Zarby::Normalize.utf8("Dur\xC3\xA9e".force_encoding('ASCII-8BIT'))
Zarby::Normalize.utf8("Aa\x80Aa\x81".force_encoding('ASCII-8BIT'))
Since V 0.1.7
Zarby.utf8("Aa\xFCAa\xDF".force_encoding('Windows-1252'))
Zarby.utf8("Aa\xFCAa\xDF".force_encoding('ASCII-8BIT'))
Zarby.utf8("Dur\xC3\xA9e".force_encoding('ASCII-8BIT'))
Zarby.utf8("Aa\x80Aa\x81".force_encoding('ASCII-8BIT'))
Anonymise
Method to anonymise a string.
Zarby.anonymise("z")
Zarby.anonymise("za")
Zarby.anonymise("zar")
Zarby.anonymise("zarb")
Zarby.anonymise("zarby")
arby.anonymise("mewtwo")
arby.anonymise("Ectoplasma")
anonymise
try to set '' between two first and two last letter of the string if lenght greater than 4.
if string length between 1 to 2, return **.
if string length = 3 return aa.
if string length = 4 return a**a.
if "@" is present, render anonymise
string before and after "@", and kept "@" symbole.
exemple:
Zarby.anonymise("z@z")
Zarby.anonymise("za@za")
Zarby.anonymise("zar@zar")
Zarby.anonymise("zarb@zarb")
Zarby.anonymise("zarby@zarby")
Zarby.anonymise("mewtwo@mewtwo")
Zarby.anonymise("Ectoplasma@Ectoplasma")
Zarby.anonymise("pichu@pikachu@raichu")
Zarby.anonymise("@fantominus@spectrum@ectoplasma@")
Contributing
Bug report and pull request are welcome on GitHub at https://github.com/zarby-ruby/zarby.