Steve Waring
Steve Waring

Reputation: 3033

How can I add a breaking space at the end of an android string resouce

With a resource such as:

<string name="str">ends with a space </string>

the space that the end is lost.

<string name="str">ends with a space&#160;</string>

keeps the space, but android treats it as a none breaking space.

Is there a way to specify a breaking space at the end of a resource string? This is for a library function, so I have no idea what strings might be specified in the resource.

Obviously I have considered:

<string name="str">ends with a space£</string>
<string name="my_breaking_space_at_end_of_android_resource">£</string>

and use a regEx.

Upvotes: 0

Views: 562

Answers (1)

Shobhit Puri
Shobhit Puri

Reputation: 26017

You seems to have tried lot of things. You can also try the following ways:

1) Just have space in end and enclose the whole string in double quotes:

<string name="foo">"End with space "</string>. 

2) Also did you try this answer, which says to try the following:

Insert \u0020 directly in the XML for a blank you would like to preserve:

<string name="foo">End with space \u0020</string>

Hope either of this helps you.

Upvotes: 1

Related Questions