Replace numbers with / into more numbers

Hi,
Challenge;
There is a list containing several textual items.
I would like to replace, all the items which contain the divide sign ‘/’.
note: ; is the dividing item

Whereby the division is made and rounded to 2 deciimals.

so for instance
4/3 --> 1.33;1.33;1.33

2020-05-20 divide sign.gh (2.4 KB)

Hi @ruud.vanknippenberg,

It’s pretty simple! You can use the Rep (Replace Text) component.


2020-05-20 divide sign 2.gh (5.2 KB)

Hi Thank you for your answer.
Unfortunately it is not that easy :slight_smile:.

Its not only that / has to be replaces by ,.

The section with the / --> represent a divide by sum.
I would like to replace the entire / sum. Bij the result of the division, whereby the results are split with an ;

so lets start with a simple example;
if there was
4/2 is has to be replaced by: 2;2
6/2 --> 3;3
8/4 --> 2;2;2;2

This should be coded.
But anyway it is done…


Ruud divide sign_RE.gh (14.5 KB)

Now challenge for you:
How to adjust definition if “Y” shows up? :wink:

Hi!

Haha thanks!
It was even better thank you think, have a look;


However, there is still 1 challenge left:
If there are multiple /'s in 1 item. It only ‘replaces’ 1 of them ánd it doubles the item.
Do you have any idea how you can replace multiple text fragment in 1 item?

Thanks again :slight_smile:


2020-05-20 divide sign_RE_re.gh (18.7 KB)

You cannot do it in your “XYZ@” way.
You will have to reuse routine i have used in 1st version or similar.

Or you can add an extra scent with looping through… :wink:

Ruud van Nistelrooy_divide sign_RE.gh (20.8 KB)

Ahh oke, thank you! :+1: