looking for string->float function and how to get a word array from a string #1226
-
Hi guys, I can't find what I'm looking for in the docs so I'm here to ask for some help.
I'm quite confident that what I'm looking for is there in the docs, I can't just find it. Additionally, does anyone know if any user has written a more organic manual than the official documentation and Ian's book "janet for mortals"? Thank you for your help! |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 2 replies
-
Regarding 1. you can use |
Beta Was this translation helpful? Give feedback.
-
For 2. perhaps spork's |
Beta Was this translation helpful? Give feedback.
-
Thank you very much @tionis, precious as always. Regarding 1) I was searching with firefox the word "convert" in the full API list page. I should have thought about looking for parse/scan or similar words as well. For 2), to be honest, I completely ignored spork's sh/* functions because I thought they were just shell related stuffs. I'll wait a bit to mark this question as answered to see if anyone points me to a book or other material about janet. Thank you again. |
Beta Was this translation helpful? Give feedback.
-
# translation: skip whitespace (if any),
# then capture required non-whitespace characters,
# followed by any amount of whitespace characters,
# an unlimited amount of times
(def splitter '(* (any :s) (any (* '(some :S) (any :s)))))
(peg/match splitter " ab cd ") # => @["ab" "cd"]
|
Beta Was this translation helpful? Give feedback.
-
https://janet-lang.org/api/string.html#string/split for 2nd is possible too. |
Beta Was this translation helpful? Give feedback.
scan-number
works