There is possible to remove bracket from array value?

Hi, im new use katalon studio.

there is possible to remove bracket from array value like this ?

i want to get value without bracket

this my code :

String[] array = findTestData('Data Files/RandomData').getAllData()

for (def index : (1..5)) {
    int random = new Random().nextInt(array.length)

    println((array[random]).toString())
}

Hi @raflianrizqi,

Hmmmm its kinda weird for me. I tried your code and I just replaced the “findTestData(‘Data Files/RandomData’).getAllData()” to a static string array values and when I print it, it doesn’t show any brackets… Maybe your values has a bracket?? if so you can try this approach…

println((array[random]).toString().replace("[", "").replace("]", ""))

You can replace the opening and closing bracket using blank value.

Hope that helps. . . :smiley:

I replicated your concern… let me try some other work arounds. . .

Hi @raflianrizqi,

I already found a solution to your problem. It will still be replace and we are going to use “replaceAll

Try this code…

println((array[random]).toString().replaceAll("\\p{P}", ""))

That should work now…

Let me know if you have any concerns. . . :smiley:

Hi @Arnel

thank you for your help, it’s working :grinning:

You’re welcome! Glad I helped :smiley:

Cheers! :beers:

Hi @Arnel

can you help me to solve this problem

i follow the tutorial in katalon doc, but stack with error :grinning: