Question

How to add (" ") to all the words i have in my String Array in eclipse?

Suppose, If i have like 100 countries name as data is it possible that i copy paste them to my

private static String[] countries = {};

and then any technique to add (" ") to all of the words inside the array?

Was it helpful?

Solution

you can use edit -> find/replace to change all the spaces to an expression like ", "

OTHER TIPS

Find \n Replace with "\n"

when you replace make sure you selected "Regular expression is on"

If you want to add " " to your arrays, you will need to add a forward slash in front of a quotation mark within your array element. An example of this would be:

static String[] countries={"\"CountryA\"", "\"CountryB\"", etc...};

Output Instead of: CountryA CountryB

The new output will be "CountryA" "CountryB"

I hope this is what you are asking for....

Do this, example you have to write America, Canada as counties , write :-

private static string[] countries = {"\"America\"","\"Canada\"}; Output will be "America" "Canada"

because to write " anywhere you have to use it with a slash\ like \" it will give ".

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top