longnt23
(Henry)
June 11, 2018, 3:23am
1
Hi everyone,
I have a string : “123,456,678(A),222,333(B),555,666(C),888,999”
Condition: If the final number is not (), the default is to add (A)
I do not know how to handle the results as follows: “123(A),456(A),678(A),222(B),333(B),555(C),666(C),888(A),999(A)”
Thank!
arivu96
(Arivazhagan A)
June 11, 2018, 3:43am
2
HI @longnt23 ,
Split the string using “,”
For loop it Add the value (A) in end
then combine the string using string.join(“,”,yourarray value)
Regards, Arivu
longnt23
(Henry)
June 11, 2018, 4:08am
3
Thank @arivu96 !
But in string: “123(A),456(A),678(A),222(B),333(B),555©,666©,888(A),999(A)” have (B) and ( C). And desired results: “123(A),456(A),678(A),222(B),333(B),555( C),666( C),888(A),999(A)”.
Thank!
lavint
June 11, 2018, 1:40pm
4
Hi @longnt23 ,
I think you can use regex and for loop to check after you split them using “,”
so… if the last character is digit, do the string.join
There is this activity called Matches and the the regex should be \d
hope it helps!
Warm regards,
Lavina