How to add extra spaces in a text field for better display?

I want more than one space to be inserted between two words in a text field. 

I have used below code, but it is not working.

a!textField(
label: "Approved: 5"& "                 Closed: 7",
readOnly: true()
)

I want to display the content in this way. Is there any way to do it.  

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    You can add extra spaces in labels by using NO-BREAK SPACE character (U+00A0) generated by the key combination Alt+0160 on Windows. It is different from normal space and has a different UNICODE. You can also copy it from here: " ".

  • 0
    Certified Lead Developer
    in reply to vinayakp

    joinarray(repeat(times: _, input: char(160)))

    This code snippet generates as many U+00A0 (which is char 160) as you need.  Just replace the underscore with whatever number of spaces you require, then concat this between the values you want to put spaces between.  Repeat generates a list, and joinArray gets rid of the ugly semicolons.

    value: "This text followed by spaces" & joinarray(repeat(times: 12, input: char(160))) & "before this text",

    OR

    value: concat( 

    "This text followed by spaces",

    joinarray(repeat(times: 12, input: char(160))),

    "before this text"

    ),

    One especially great thing about this is that it allows you to set up the spacing as a constant, so you can easily keep spacing consistent across the entire application, if you want to.

Reply
  • 0
    Certified Lead Developer
    in reply to vinayakp

    joinarray(repeat(times: _, input: char(160)))

    This code snippet generates as many U+00A0 (which is char 160) as you need.  Just replace the underscore with whatever number of spaces you require, then concat this between the values you want to put spaces between.  Repeat generates a list, and joinArray gets rid of the ugly semicolons.

    value: "This text followed by spaces" & joinarray(repeat(times: 12, input: char(160))) & "before this text",

    OR

    value: concat( 

    "This text followed by spaces",

    joinarray(repeat(times: 12, input: char(160))),

    "before this text"

    ),

    One especially great thing about this is that it allows you to set up the spacing as a constant, so you can easily keep spacing consistent across the entire application, if you want to.

Children
No Data