String split

Started by William Malabry, February 12, 2022, 12:59:49 PM

Previous topic - Next topic

William Malabry

I searched in the forum archives but didn't find an answer.
I want to split a string with a separator and get an array.

I tried the javascript String way :
myDate = '12/02/2022';
splittedDate = myDate.split('/');

But it does not work.
Apart from splitting with regular expressions, is there is a simple way to do this in jArchi ?

Thanks in advance for your help.


Phil Beauvoir

JS split does work, but you have to treat the result as an array:

myDate = '12/02/2022';
splittedDate = myDate.split('/');
If you value and use Archi, please consider making a donation!
Ask your ArchiMate related questions to the ArchiMate Community's Discussion Board.

William Malabry

In fact, I had two errors : using it as a non array value and one value to split was null which ended in a JS error...

Thank you very much Phil.