mirror of
https://github.com/zeek/zeek.git
synced 2025-10-03 07:08:19 +00:00
66 lines
1.2 KiB
Text
66 lines
1.2 KiB
Text
Justification (input string 'abc')
|
|
----------------------------------
|
|
ljust: 'abc'
|
|
ljust: 'abc'
|
|
ljust: 'abc '
|
|
ljust: 'abc--'
|
|
rjust: 'abc'
|
|
rjust: 'abc'
|
|
rjust: ' abc'
|
|
rjust: '--abc'
|
|
zfill: 'abc'
|
|
zfill: 'abc'
|
|
zfill: '00abc'
|
|
|
|
Content checking
|
|
----------------
|
|
is_num abc : 0
|
|
is_num 123 : 1
|
|
is_alpha ab : 1
|
|
is_alpha 1a : 0
|
|
is_alpha a1 : 0
|
|
is_alnum ab : 1
|
|
is_alnum 1a : 1
|
|
is_alnum a1 : 1
|
|
is_alnum 12 : 1
|
|
is_alnum ##12: 0
|
|
|
|
String counting (input str 'aabbaa')
|
|
------------------------------------
|
|
count_substr aa: 2
|
|
count_substr bb: 1
|
|
count_substr cc: 0
|
|
|
|
Starts/endswith
|
|
---------------
|
|
starts_with bro: 1
|
|
starts_with ids: 0
|
|
ends_with ids: 1
|
|
ends_with bro: 0
|
|
|
|
Transformations
|
|
---------------
|
|
swap_case 'aBc': AbC
|
|
to_title 'bro is a very neat ids': 'Bro Is A Very Neat Ids'
|
|
to_title ' ': ' '
|
|
to_title ' a c ': ' A C '
|
|
remove_prefix 'ananab'/'an' : ab
|
|
remove_prefix 'anatnab'/'an': atnab
|
|
remove_suffix 'banana'/'na' : ba
|
|
remove_suffix 'bantana'/'na': banta
|
|
|
|
find_str/rfind_str (input string 'abcdefghi')
|
|
-----------------------------------------------------
|
|
find_str: 0
|
|
find_str: -1
|
|
find_str: -1
|
|
find_str: 4
|
|
find_str: 4
|
|
find_str: -1
|
|
find_str: 0
|
|
find_str: -1
|
|
find_str: -1
|
|
find_str: 4
|
|
find_str: 4
|
|
find_str: -1
|
|
|