Convert One Line List to Multiple Line in the Script

Engaged ,
Apr 10, 2021 Apr 10, 2021

Copy link to clipboard

Copied

Hi Experts

Im Wondering How do I Convert Long List in My Script to Small One?, I have a list of numbers Look like :

 

MyList = ["1", "2", "3", "4", "5", etc to----> ,"1000"]

 

So it is so long in the script , So how i can make it appear divided in Multiple Lines? My Question is How to make the multiple return automatically (it will create multiple lines of the list) ?

Thanks in Advance

Best

M.Hasanain

Best
M.Hasanain
TOPICS
Scripting

Views

62

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct Answer

Adobe Community Professional , Apr 11, 2021 Apr 11, 2021
Maybe you could try the wrap feature of editors and define the no. of characters after which the code line has to be wrapped to the next line. You could use soft wrap if just the appearance of the line is what you need, but you don't want to insert an actual newline character. See the following https://stackoverflow.com/questions/319925/difference-between-hard-wrap-and-soft-wrap -Manan

Likes

Translate

Translate
Adobe Community Professional ,
Apr 10, 2021 Apr 10, 2021

Copy link to clipboard

Copied

I don't really understand but, ... a for loop?

var makeArr = function() {

var a = new Array(1000);  

for (var i = 0; i < 1000; i++) {

     a[i] = i + 1 + "";

}

return a;

}

var MyList = makeArr();

 

Otherwise, you can put as many return marks as you want in the code:

a =["1","2","3",

"4","5","6",

"7","8","9",

//Etc

];

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Apr 11, 2021 Apr 11, 2021

Copy link to clipboard

Copied

Thanks Mr.brianp311 for your reply, yes the second answer is what i mean, so how i can put many return marks in my code autmatically ? Like you showed me here :

a =["1","2","3",
"4","5","6",
"7","8","9",
//Etc
];

Thank You again

Best
M.Hasanain

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Apr 11, 2021 Apr 11, 2021

Copy link to clipboard

Copied

If it's about splitting the array definition across multiple lines then you can try the following

var MyList = [1,
2,3, 
4, 
5]
alert(MyList)

-Manan

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Apr 11, 2021 Apr 11, 2021

Copy link to clipboard

Copied

Thank You Mr.Manan But My Question is How to make the multiple return automatically ? do you think it can be done automatically?

Best
M.Hasanain

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Apr 11, 2021 Apr 11, 2021

Copy link to clipboard

Copied

Maybe you could try the wrap feature of editors and define the no. of characters after which the code line has to be wrapped to the next line. You could use soft wrap if just the appearance of the line is what you need, but you don't want to insert an actual newline character. See the following

https://stackoverflow.com/questions/319925/difference-between-hard-wrap-and-soft-wrap

-Manan

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Apr 11, 2021 Apr 11, 2021

Copy link to clipboard

Copied

Thank you it Works from View Menu of the Editor (View > Word Wrap) -Shift + Ctrl + W

Word Wraps.jpg

Best
M.Hasanain

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Apr 11, 2021 Apr 11, 2021

Copy link to clipboard

Copied

LATEST

Thank You @brianp311  Thank You @Manan Joshi  for your great Help

Best Regards

M.Hasanain

Best
M.Hasanain

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines