How to store a string array inside a string in java

You can do it like this:

s = s.replace("a[0]", s1[0]).replace("a[1]", s1[1])

The only issue is that you have no ‘a[1]’ substring in your string – there just ‘[1]’ – let’s think it’s just a typo.

Leave a Comment