Determine if a string has all unique characters: Difference between revisions
Determine if a string has all unique characters (view source)
Revision as of 05:37, 7 May 2021
, 3 years ago→{{header|jq}}: general hex function
(→{{header|jq}}: general hex function) |
|||
Line 2,106:
Some helper functions for accomplishing other aspects of the task:
<lang jq>
def hex:
def hx: [if . < 10 then 48 + . else 55 + . end] | implode ;▼
def stream:
recurse(if . > 0 then ./16|floor else empty end) | . % 16 ;
if type=="string" then explode[0] else . end
| if . == 0 then "0"
else [stream] | reverse | .[1:]
end;
def lpad($len): tostring |
def q: "«\(.)»";
Line 2,135 ⟶ 2,141:
«abcABC» : 6 : : []
«XYZ ZYX» : 7 : Z : 5A [2,4]
«1234567890ABCDEFGHIJKLMN0PQRSTUVWXYZ» : 36 : 0 : 30 [9,24]</lang>
=={{header|Julia}}==
|