Any trick how to view with out spaces?

Explorer ,
Nov 12, 2018

Copy link to clipboard

Copied

var num=12

var num1=33

var hm=apple

var al=orange

if var's has values:

var num=12

var num1=33

var hm=apple

var al=orange

this.getField("Text1").value="check"+num+" "+hm+" "+num1+" "+al+" with :"

i want this

check 12 apple 33 orange

but when i have

var num=""

var num1=33

var hm=""

var al=orange

check     33 orange

why var with "" system add space? how to add "nothing"

e.g.

check 33 orange

Adobe Community Professional
Correct answer by Bernd Alheit | Adobe Community Professional

var text1 = "name:";

var text2 = "";

var text3 = text1;

if (text2 != "") text3 = text3 + " " + text2;

TOPICS
Acrobat SDK and JavaScript

Views

148

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

Any trick how to view with out spaces?

Explorer ,
Nov 12, 2018

Copy link to clipboard

Copied

var num=12

var num1=33

var hm=apple

var al=orange

if var's has values:

var num=12

var num1=33

var hm=apple

var al=orange

this.getField("Text1").value="check"+num+" "+hm+" "+num1+" "+al+" with :"

i want this

check 12 apple 33 orange

but when i have

var num=""

var num1=33

var hm=""

var al=orange

check     33 orange

why var with "" system add space? how to add "nothing"

e.g.

check 33 orange

Adobe Community Professional
Correct answer by Bernd Alheit | Adobe Community Professional

var text1 = "name:";

var text2 = "";

var text3 = text1;

if (text2 != "") text3 = text3 + " " + text2;

TOPICS
Acrobat SDK and JavaScript

Views

149

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
Nov 12, 2018 0
Adobe Community Professional ,
Nov 12, 2018

Copy link to clipboard

Copied

In your code you adds the spaces like this:

+" "+

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
Reply
Loading...
Nov 12, 2018 0
Explorer ,
Nov 13, 2018

Copy link to clipboard

Copied

Yes because on this e.g

check 12 apple 33 orange

Must have +" "+

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
Reply
Loading...
Nov 13, 2018 0
Adobe Community Professional ,
Nov 13, 2018

Copy link to clipboard

Copied

Add the space only when you add non-empty text.

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
Reply
Loading...
Nov 13, 2018 0
Explorer ,
Nov 13, 2018

Copy link to clipboard

Copied

How to create that? Any example please?

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
Reply
Loading...
Nov 13, 2018 0
Adobe Community Professional ,
Nov 13, 2018

Copy link to clipboard

Copied

var text1 = "name:";

var text2 = "";

var text3 = text1;

if (text2 != "") text3 = text3 + " " + text2;

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
Reply
Loading...
Nov 13, 2018 1