/estring

emoji,html-entities,string APIs (some javascript style APIs)

Primary LanguagePythonMIT LicenseMIT

estring

javascript style APIs for string

install

pip3 install estring

QUICK


    BASIC_PY_LESSONS# eses_emoji_strict te
    < telephone >
    < tent >
    < teacup_without_handle >
    < ten_o_clock >
    < ten_thirty >
    < tennis >
    < teddy_bear >
    < telephone_receiver >
    < television >
    < tear_off_calendar >
    < test_tube >
    < telescope >
    BASIC_PY_LESSONS#
    BASIC_PY_LESSONS# eses_emoji_strict telephone
    ☎
    < telephone_receiver >
    BASIC_PY_LESSONS#
    BASIC_PY_LESSONS# eses_emoji_strict telescope
    🔭
    BASIC_PY_LESSONS#

    BASIC_PY_LESSONS# eses_emoji_loose sneezing
    < cowboy_hat_face_sneezing_face_0 >
    < cowboy_hat_face_sneezing_face_1 >
    < cowboy_hat_face_sneezing_face_2 >
    < cowboy_hat_face_sneezing_face_3 >
    < cowboy_hat_face_sneezing_face_4 >
    < cowboy_hat_face_sneezing_face_5 >
    < cowboy_hat_face_sneezing_face_6 >
    < cowboy_hat_face_sneezing_face_7 >
    < sneezing_face >
    BASIC_PY_LESSONS#
    BASIC_PY_LESSONS# eses_emoji_loose cowboy_hat_face_sneezing_face_3
    🤣
    BASIC_PY_LESSONS# eses_emoji_loose cowboy_hat_face_sneezing_face_4
    🤤
    BASIC_PY_LESSONS# eses_emoji_loose cowboy_hat_face_sneezing_face_5
    🤥
    BASIC_PY_LESSONS#

FORMATTED EMOJI RESOURCES

#this original  txt file is from 
#http://unicode.org/Public/emoji/12.0/

emoji.csv
emoji.dtb.json
emoji.cls.json
emoji.sqlite.db

SPECIAL CHARS APIs


EMOJI API

    from estring.emoji.emoji  import emoji
    >>> emoji.te
    emoji.teacup_without_handle  emoji.telephone              emoji.television             emoji.tennis
    emoji.tear_off_calendar      emoji.telephone_receiver     emoji.ten_o_clock            emoji.tent
    emoji.teddy_bear             emoji.telescope              emoji.ten_thirty             emoji.test_tube
    >>> emoji.teacup_without_handle
    '🍵'
    >>>

H5 ENTITY

    from estring.h5entity import h5
    >>> h5.theta
    'θ'
    >>> h5.the
    h5.there4     h5.therefore  h5.theta      h5.thetasym   h5.thetav
    >>> h5.theta
    'θ'
    >>> h5.The
    h5.Therefore  h5.Theta
    >>> h5.Theta
    'Θ'
    >>>

javascript style string APIs


├──0. length<0>
├──0. length<1>  
├──1. fromCharCode
├──2. fromCodePoint  
├──3. charAt<1>  
├──3. charAt<2>  
├──4. charCodeAt<1>  
├──4. charCodeAt<2>  
├──5. codePointAt<1>  
├──5. codePointAt<2>  
├──6. concat  
├──7. endsWith  
├──8. includes  
├──9. indexOf  
├──10. padEnd  
├──11. padStart  
├──12. repeat
├──13. replace
├──13. replace
├──13. replace
├──13. replace
├──14. slice<0>
├──14. slice<1>
├──15. split
├──15. search_gen
├──15. find_all_spans
├──15. regex_divide
├──16. startsWith
├──17. substr
├──18. substring
├──19. toLowerCase
├──20. toUpperCase
├──21. trim
├──22. trimLeft
├──23. trimRight
├──.


supplementary APIs


├──0. divide
├──1. indexesAll
├──2. strip
├──3. lstrip
├──4. rstrip
├──5. reverse
├──6. prepend
├──7. append
├──8. xor
├──9. tail2head
├──10. end2begin
├──11. head2tail
├──12. begin2end
├──13. display_width
├──14. prepend_basedon_displaywidth
├──15. append_basedon_displaywidth
├──16.
├──17.



IO APIs


├──0. str2io
├──1.



encode decode APIs


├──0. get_bominfo
├──1. remove_bom
├──2. get_bomtype<1>
├──3. get_bomtype<2>
├──4. decode_chbyts
├──4. byts2chstr  
├──4. unpack_chbyts
├──5. pack_chstr
├──5. chstr2byts
├──5. encode_chstr
├──6. pack_chnum  
├──6. chnum2byts  
├──6. encode_chnum  
├──7. byts2chnum  
├──8. decode_bytstrm  
├──8. bytstrm2str  
├──8. unpack_bytstrm  
├──9. pack_str  
├──9. encode_str  
├──9. str2bytstrm  
├──10. slash_show  
├──11. bytstrm2hex  
├──12. hex2bytstrm  
├──13. strm2bytnums  
├──14. bytnums2strm  
├──15. bytstrm2chnums  
├──16. strm2chnums  
├──17. chnums2bytstrm  
├──18. chnums2strm  
├──19. bytstrm2us<1>  
├──19. bytstrm2us<2>  
├──20. us2bytstrm<1>  
├──21. us2bytstrm<2>  
├──22. us2bytstrm<3>  
├──23. str2hex  
├──24. hex2str  
├──25. str2chnums  
├──26. chnums2str  
├──27. str2bytnums  
├──28. bytnums2str  
├──29. str2us  
├──30. us2str  
├──31. hex2bytnums  
├──32. bytnums2hex  
├──33. hex2chnums  
├──34. chnums2hex  
├──35. hex2us  
├──36. us2hex  
├──37. chnums2bytnums  
├──38. bytnums2chnums  
├──39. chnums2us  
├──40. us2chnums  
├──41. bytnums2us  
├──42. us2bytnums  
├──43. str_code_points<0>  
├──44. str_code_points<1>  
├──45. str_jschar_points  
├──46. pychpoints2jscharpoints  
├──47. jscharpoints2pychpoints  
├──48. us2uarr  
├──49. uarr2us  
├──50. uarr2jscharr  
├──51. uarr2str  
├──52. str2uarr  
├──53. str2jscharr  
├──54. camel2dash  
├──55. camel2lod  
├──56. capinit  
├──57. dash2camel  
├──58. dash2lod  
├──59. lod2camel  
├──60. lod2dash  
├──61. is_int_str  
├──62. is_float_str  
├──63. reverse_four_bytes_keeping_bitorder  

CLI


  • eses_camel2dash

  • eses_camel2lod

  • eses_capinit

  • eses_dash2camel

  • eses_dash2lod

  • eses_lod2camel

  • eses_lod2dash

      estring# eses_camel2dash   acceptCharset
      accept-charset
      estring# eses_camel2lod    acceptCharset
      accept_charset
      estring# eses_capinit      accept
      Accept
      estring# eses_dash2camel   accept-charset
      acceptCharset
      estring# eses_dash2lod     accept-charset
      accept_charset
      estring# eses_lod2camel    accept_charset
      acceptCharset
      estring# eses_lod2dash     accept_charset
      accept-charset
    
  • eses_h5entity_strict

      ESTRING# eses_h5entity_strict theta
      θ
      < thetasym >
      < thetav >
      ESTRING#
      ESTRING# eses_h5entity_strict the
      < there4 >
      < therefore >
      < theta >
      < thetasym >
      < thetav >
      ESTRING#
      ESTRING# eses_h5entity_strict theta
      θ
      < thetasym >
      < thetav >
      ESTRING#
      ESTRING# eses_h5entity_strict alph
      < alpha >
      ESTRING#
      ESTRING# eses_h5entity_strict alpha
      α
      ESTRING#
    

*eses_h5entity_loose

    ESTRING# eses_h5entity_loose Op
    < OpenCurlyDoubleQuote >
    < OpenCurlyQuote >
    ESTRING#
    ESTRING# eses_h5entity_loose OpenCurlyDoubleQuote
    “
    ESTRING#

*eses_emoji_strict

    BASIC_PY_LESSONS# eses_emoji_strict te
    < telephone >
    < tent >
    < teacup_without_handle >
    < ten_o_clock >
    < ten_thirty >
    < tennis >
    < teddy_bear >
    < telephone_receiver >
    < television >
    < tear_off_calendar >
    < test_tube >
    < telescope >
    BASIC_PY_LESSONS#
    BASIC_PY_LESSONS# eses_emoji_strict telephone
    ☎
    < telephone_receiver >
    BASIC_PY_LESSONS#
    BASIC_PY_LESSONS# eses_emoji_strict telescope
    🔭
    BASIC_PY_LESSONS#

*eses_emoji_loose

    BASIC_PY_LESSONS# eses_emoji_loose gon
    < mahjong_red_dragon >
    < dragon_face >
    < dragon >
    < mahjong_tile_red_dragon >
    BASIC_PY_LESSONS#
    BASIC_PY_LESSONS# eses_emoji_strict mahjong_red_dragon
    🀄
    BASIC_PY_LESSONS#

CONSTS


    >>> from estring.consts import *
    >>>
    >>>
    >>> greece_lowerch
    'αβγδεζηθικλμνξοπρστυφχψω'
    >>>
    >>> greece_upperch
    'ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ'
    >>>
    >>> greece_chname
    ['alpha', 'beta', 'gamma', 'delta', 'epsilon', 'zeta', 'eta', 'theta', 'iota', 'kappa', 'lambda', 'mu', 'nu', 'xi', 'omicron', 'pi', 'rho', 'sigma', 'tau', 'upsilon', 'phi', 'chi', 'psi', 'omega']
    >>>
    >>> greece_lowerch_ord
    [945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 963, 964, 965, 966, 967, 968, 969]
    >>>
    >>> greece_upperch_ord
    [913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 931, 932, 933, 934, 935, 936, 937]
    >>>


    >>> eascii
    '\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0¡¢£¤¥¦§¨©ª«¬\xad®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ'
    >>>
    >>> ascii_valid_attrname_init_char
    'ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyzªµºÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ'
    >>>
    >>> ascii_valid_attrname_noninit_char
    '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyzªµ·ºÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ'
    >>>

    >>> pobj(greece_md)
    {
     'alpha': 'α',
     'beta': 'β',
     'gamma': 'γ',
     'delta': 'δ',
     'epsilon': 'ε',
     'zeta': 'ζ',
     'eta': 'η',
     'theta': 'θ',
     'iota': 'ι',
     'kappa': 'κ',
     'lambda': 'λ',
     'mu': 'μ',
     'nu': 'ν',
     'xi': 'ξ',
     'omicron': 'ο',
     'pi': 'π',
     'rho': 'ρ',
     'sigma': 'σ',
     'tau': 'τ',
     'upsilon': 'υ',
     'phi': 'φ',
     'chi': 'χ',
     'psi': 'ψ',
     'omega': 'ω',
     'α': 'alpha',
     'β': 'beta',
     'γ': 'gamma',
     'δ': 'delta',
     'ε': 'epsilon',
     'ζ': 'zeta',
     'η': 'eta',
     'θ': 'theta',
     'ι': 'iota',
     'κ': 'kappa',
     'λ': 'lambda',
     'μ': 'mu',
     'ν': 'nu',
     'ξ': 'xi',
     'ο': 'omicron',
     'π': 'pi',
     'ρ': 'rho',
     'σ': 'sigma',
     'τ': 'tau',
     'υ': 'upsilon',
     'φ': 'phi',
     'χ': 'chi',
     'ψ': 'psi',
     'ω': 'omega'
    }
    >>>


    >>> ascii_html_escape_free
    '\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f !#$%()*+,-./0123456789:;=?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0¡¢£¤¥¦§¨©ª«¬\xad®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ'


    >>> html_md
    {'"': '&quot;', '&': '&amp;', "'": '&#x27;', '<': '&lt;', '>': '&gt;', '&quot;': '"', '&amp;': '&', '&#x27;': "'", '&lt;': '<', '&gt;': '>'}

    >>> estring.consts.ascii_urlquote_free
    '-./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz'
    >>>
    >>>
    >>> estring.consts.ascii_normal_attrname_init
    'ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz'
    >>>
    >>> estring.consts.ascii_normal_attrname_noninit
    '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz'
    >>>

    >>>number_replacer
    {
     'Α': '0',
     'Β': '1',
     'Γ': '2',
     'Δ': '3',
     'Ε': '4',
     'Ζ': '5',
     'Η': '6',
     'Θ': '7',
     'Ι': '8',
     'Κ': '9',
     '0': 'Α',
     '1': 'Β',
     '2': 'Γ',
     '3': 'Δ',
     '4': 'Ε',
     '5': 'Ζ',
     '6': 'Η',
     '7': 'Θ',
     '8': 'Ι',
     '9': 'Κ'
    }