Determine if a string has all unique characters: Difference between revisions

Content added Content deleted
(→‎{{header|Vlang}}: Rename "Vlang" in "V (Vlang)")
(→‎{{header|jq}}: simplify)
Line 2,366: Line 2,366:
def hex:
def hex:
def stream:
def stream:
recurse(if . > 0 then ./16|floor else empty end) | . % 16 ;
recurse(if . >= 16 then ./16|floor else empty end) | . % 16 ;
if type=="string" then explode[0] else . end
if type=="string" then explode[0] else . end
| if . == 0 then "0"
| [stream] | reverse
else [stream] | reverse | .[1:]
| map(if . < 10 then 48 + . else . + 87 end) | implode ;
| map(if . < 10 then 48 + . else . + 87 end) | implode
end;


def lpad($len): tostring | " " * ($len - width) + .;
def lpad($len): tostring | " " * ($len - width) + .;