# New line if



## itsnotalina (17. Sep 2022)

Hi Guys

I'm totally helpless.

I just started to make a PDF Form and need to adjust some things with the JavaScript editor. I'm a newbie.

So I have a dropdown with names which contains adress lines in the background.

An adress line is for example: Randomstreet 3 -- 3456 Randomcity

Now what i want to have at the end is this:

andomstreet 3
3456 Randomcity

What code do I have to use to add a new line to every "--"?

Thanks so much for your help!


----------



## KonradN (18. Sep 2022)

If you just want to keep the result in one String then simply use String.replace to replace the " -- " with a newline:








						JavaScript String replace() Method
					

W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.




					www.w3schools.com
				




And always be aware where you want to use the result. Depending on the target, '\n' might not be the best.

'\r' might be requested as newline (e.g. addWatermarkFromText method of Doc)
in HTML a '<BR>' might be required.

There is a API Reference for Adobe Acrobat Javascript sdk that might be of help to determine what is required:


			https://opensource.adobe.com/dc-acrobat-sdk-docs/acrobatsdk/pdfs/acrobatsdk_jsapiref.pdf


----------



## KonradN (18. Sep 2022)

I read, what the person wrote and I simply focused on that.

Und wenn der kleine Tobias nicht wieder aus dem Bällespieleparadies abgeholt werden möchte, dann sollte er ggf. versuchen, Argumente zu bringen statt einfach nur so dümmste Kommentare zu schreiben. Aber wie immer bei Tobias: Extrem viel (dümmste) Meinung und kein einziges Argument.


----------



## KonradN (18. Sep 2022)

ps_one hat gesagt.:


> It is extremely rude not to answer in a language the questioner can understand. So much for Konrad's behavior here.


It was a reply directly to you. And if you think, that the language is that important: The rude part would have been an english post in a german only forum 

I know - that is to much to understand for you. But don't worry - I am quite sure that some admin will solve this issue quickly


----------

