Liking cljdoc? Tell your friends :D

nnichols.parse

A bunch of utility functions for parsing strings to the types they represent

A bunch of utility functions for parsing strings to the types they represent
raw docstring

float-regexclj/s

source

float-string?clj/s

(float-string? float-string)

Returns true if float-string representss a valid float, false otherwise.

Returns true if `float-string` representss a valid float, false otherwise.
sourceraw docstring

parse-binaryclj/s

(parse-binary binary-str)

Parse binary-str to the positive integer it represents in binary

Parse `binary-str` to the positive integer it represents in binary
sourceraw docstring

parse-binary-or-zeroclj/s

(parse-binary-or-zero binary-str)

Like try-parse-binary, but returns a 0 instead of nil. Useful when passing return values into numeric operations.

Like `try-parse-binary`, but returns a 0 instead of nil.
Useful when passing return values into numeric operations.
sourceraw docstring

parse-booleanclj/s

(parse-boolean bool-str)

Like parse-boolean-string, but returns boolean values passed through and uses clojure's definition of truthiness for all other values

Like `parse-boolean-string`, but returns boolean values passed through and uses clojure's definition of truthiness for all other values
sourceraw docstring

parse-boolean-strictclj/s

(parse-boolean-strict bool-str)

Like parse-boolean, but throws an exception for values that are neither booleans nor true/false strings. Useful for spec/conformance.

Like `parse-boolean`, but throws an exception for values that are neither booleans nor true/false strings.
Useful for spec/conformance.
sourceraw docstring

parse-boolean-stringclj/s

(parse-boolean-string bool-str)

Convert bool-str to a boolean for the strings true/false (Any casing)

Convert `bool-str` to a boolean for the strings true/false (Any casing)
sourceraw docstring

parse-doubleclj

(parse-double double-string)

Parse double-string to an instance of the JVM's Double class

Parse `double-string` to an instance of the JVM's Double class
sourceraw docstring

parse-double-or-zeroclj

(parse-double-or-zero double-string)

Like try-parse-double, but returns 0.0 instead of nil. Useful when passing return values into numeric operations.

Like `try-parse-double`, but returns 0.0 instead of nil.
Useful when passing return values into numeric operations.
sourceraw docstring

parse-floatclj/s

(parse-float float-string)

Parse float-string to the floating point decimal it represents

Parse `float-string` to the floating point decimal it represents
sourceraw docstring

parse-float-or-zeroclj/s

(parse-float-or-zero float-string)

Like try-parse-float, but returns 0.0 instead of nil. Useful when passing return values into numeric operations.

Like `try-parse-float`, but returns 0.0 instead of nil.
Useful when passing return values into numeric operations.
sourceraw docstring

parse-guidclj/s

(parse-guid guid-str)

Parse guid-str to the GUID it represents

Parse `guid-str` to the GUID it represents
sourceraw docstring

parse-hexclj/s

(parse-hex hex-str)

Parse hex-str to the positive integer it represents in hexidecimal

Parse `hex-str` to the positive integer it represents in hexidecimal
sourceraw docstring

parse-hex-or-zeroclj/s

(parse-hex-or-zero hex-str)

Like try-parse-hex, but returns a 0 instead of nil. Useful when passing return values into numeric operations.

Like `try-parse-hex`, but returns a 0 instead of nil.
Useful when passing return values into numeric operations.
sourceraw docstring

parse-intclj/s

(parse-int dec-str)

Parses dec-str to the positive integer it represents

Parses `dec-str` to the positive integer it represents
sourceraw docstring

parse-int-or-zeroclj/s

(parse-int-or-zero int-str)

Like try-parse-int, but returns a 0 instead of nil. Useful when passing return values into numeric operations.

Like `try-parse-int`, but returns a 0 instead of nil.
Useful when passing return values into numeric operations.
sourceraw docstring

parse-octalclj/s

(parse-octal octal-str)

Parse octal-str to the positive integer it represents in octal

Parse `octal-str` to the positive integer it represents in octal
sourceraw docstring

parse-octal-or-zeroclj/s

(parse-octal-or-zero octal-str)

Like try-parse-octal, but returns a 0 instead of nil. Useful when passing return values into numeric operations.

Like `try-parse-octal`, but returns a 0 instead of nil.
Useful when passing return values into numeric operations.
sourceraw docstring

parse-radixclj/s

(parse-radix int-str radix)

Convert int-str to the positive integer it represents w.r.t. the radix e.g. (parse-radix "10010" 2) would return 18

Convert `int-str` to the positive integer it represents w.r.t. the `radix`
e.g. (parse-radix "10010" 2) would return 18
sourceraw docstring

parse-radix-or-zeroclj/s

(parse-radix-or-zero int-str radix)

Like try-parse-radix, but returns a 0 instead of nil. Useful when passing return values into numeric operations.

Like `try-parse-radix`, but returns a 0 instead of nil.
Useful when passing return values into numeric operations.
sourceraw docstring

parse-uuidclj/s

(parse-uuid uuid-str)

Parse uuid-str to the UUID it represents

Parse `uuid-str` to the UUID it represents
sourceraw docstring

try-parse-binaryclj/s

Like parse-binary, but returns nil for invalid input.

Like `parse-binary`, but returns nil for invalid input.
sourceraw docstring

try-parse-boolean-stringclj/s

Like parse-binary, but returns nil for invalid input.

Like `parse-binary`, but returns nil for invalid input.
sourceraw docstring

try-parse-doubleclj

(try-parse-double double-string)

Like parse-double, but returns double-string for doubles, and nil for invalid input

Like `parse-double`, but returns double-string for doubles, and nil for invalid input
sourceraw docstring

try-parse-floatclj/s

(try-parse-float float-string)

Like parse-float, but returns float-string for floats, and nil for invalid input

Like `parse-float`, but returns float-string for floats, and nil for invalid input
sourceraw docstring

try-parse-guidclj/s

(try-parse-guid u)

Like parse-guid, but returns u if it's already a GUID, or nil for invalid inputs.

Like `parse-guid`, but returns `u` if it's already a GUID, or nil for invalid inputs.
sourceraw docstring

try-parse-hexclj/s

Like parse-hex, but returns nil for invalid input.

Like `parse-hex`, but returns nil for invalid input.
sourceraw docstring

try-parse-intclj/s

Like parse-int, but returns nil for invalid input.

Like `parse-int`, but returns nil for invalid input.
sourceraw docstring

try-parse-octalclj/s

Like parse-octal, but returns nil for invalid input.

Like `parse-octal`, but returns nil for invalid input.
sourceraw docstring

try-parse-radixclj/s

Like parse-radix, but returns nil for invalid input.

Like `parse-radix`, but returns nil for invalid input.
sourceraw docstring

try-parse-uuidclj/s

(try-parse-uuid u)

Like parse-uuid, but returns u if it's already a UUID, or nil for invalid inputs.

Like `parse-uuid`, but returns `u` if it's already a UUID, or nil for invalid inputs.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close