Skip to content

Commit

Permalink
String tools 'number to string' mode (#3998)
Browse files Browse the repository at this point in the history
* String tools 'number to string' mode

* spacing fix
  • Loading branch information
vicdoval authored Mar 28, 2021
1 parent 1a168ae commit 22b100e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions nodes/text/string_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def find_all(text, chars):
out.append(f)
index=f+1
return out

def find_all_slice(text, chars, start, end):
out =[]
index=start
Expand All @@ -64,10 +65,14 @@ def find_all_slice(text, chars, start, end):
index=f+1
return out

def number_to_string(data, precision):
return ("{:." + str(precision) + "f}").format(float(data))

func_dict = {
"---------------OPS" : "#---------------------------------------------------#",
"to_string": (0, str, ('t t'), "To String"),
"to_number": (1, eval, ('t s'), "To Number"),
"num_to_str": (3, number_to_string , ('ss t'), "Number To String", ('Precision',)),
"join": (5, lambda x, y: ''.join([x,y]), ('tt t'), "Join"),
"join_all": (6, join, ('tb t'), "Join All", ('Add Break Lines',)),
"split": (10, split, ('tcs t'), "Split", ('Spliter', 'Max Split')),
Expand Down

0 comments on commit 22b100e

Please sign in to comment.