xstrings: 一組實用的Go語言字符串函數

jopen 10年前發布 | 17K 次閱讀 xstrings Google Go/Golang開發

Go包xstrings是一組在其他語言中被廣泛使用字符串函數,但不存在于Go標準字符串包的集合中。所有功能都經過充分測試和精心調整性能。

Packagexstringsfunctions

Keep this table sorted by Function in ascending order.

Function Friends #
Center str.centerin Python;String#centerin Ruby #30
Count String#countin Ruby #16
Delete String#deletein Ruby #17
ExpandTabs str.expandtabsin Python #27
FirstRuneToLower lcfirstin PHP or Perl #15
FirstRuneToUpper String#capitalizein Ruby;ucfirstin PHP or Perl #15
Insert String#insertin Ruby #18
LastPartition str.rpartitionin Python;String#rpartitionin Ruby #19
LeftJustify str.ljustin Python;String#ljustin Ruby #28
Len mb_strlenin PHP #23
Partition str.partitionin Python;String#partitionin Ruby #10
Reverse String#reversein Ruby;strrevin PHP;reversein Perl #7
RightJustify str.rjustin Python;String#rjustin Ruby #29
RuneWidth - #27
Scrub String#scrubin Ruby #20
Shuffle str_shufflein PHP #13
ShuffleSource str_shufflein PHP #13
Slice mb_substrin PHP #9
Squeeze String#squeezein Ruby #11
Successor String#succorString#nextin Ruby #22
SwapCase str.swapcasein Python;String#swapcasein Ruby #12
ToCamelCase String#camelizein RoR #1
ToSnakeCase String#underscorein RoR #1
Translate str.translatein Python;String#trin Ruby;strtrin PHP;tr///in Perl #21
Width mb_strwidthin PHP #26
WordCount str_word_countin PHP #14
WordSplit - #14

Packagestringsfunctions

Keep this table sorted by Function in ascending order.

Function Friends
Contains String#include?in Ruby
ContainsAny -
ContainsRune -
Count str.countin Python;substr_countin PHP
EqualFold stricmpin PHP;String#casecmpin Ruby
Fields str.splitin Python;splitin Perl;String#splitin Ruby
FieldsFunc -
HasPrefix str.startswithin Python;String#start_with?in Ruby
HasSuffix str.endswithin Python;String#end_with?in Ruby
Index str.indexin Python;String#indexin Ruby;strposin PHP;indexin Perl
IndexAny -
IndexByte -
IndexFunc -
IndexRune -
Join str.joinin Python;Array#joinin Ruby;implodein PHP;joinin Perl
LastIndex str.rindexin Python;String#rindex;strrposin PHP;rindexin Perl
LastIndexAny -
LastIndexFunc -
Map String#each_codepointin Ruby
Repeat operator*in Python and Ruby;str_repeatin PHP
Replace str.replacein Python;String#subin Ruby;str_replacein PHP
Split str.splitin Python;String#splitin Ruby;explodein PHP;splitin Perl
SplitAfter -
SplitAfterN -
SplitN str.splitin Python;String#splitin Ruby;explodein PHP;splitin Perl
Title str.titlein Python
ToLower str.lowerin Python;String#downcasein Ruby;strtolowerin PHP;lcin Perl
ToLowerSpecial -
ToTitle -
ToTitleSpecial -
ToUpper str.upperin Python;String#upcasein Ruby;strtoupperin PHP;ucin Perl
ToUpperSpecial -
Trim str.stripin Python;String#stripin Ruby;trimin PHP
TrimFunc -
TrimLeft str.lstripin Python;String#lstripin Ruby;ltrimin PHP
TrimLeftFunc -
TrimPrefix -
TrimRight str.rstripin Python;String#rstripin Ruby;rtrimin PHP
TrimRightFunc -
TrimSpace str.stripin Python;String#stripin Ruby;trimin PHP
TrimSuffix String#chompin Ruby;chompin Perl

項目主頁:http://www.baiduhome.net/lib/view/home/1435040660700

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!