corwin42 Expert Licensed User Longtime User Mar 15, 2017 #1 Hello, I'm trying to create something like this in the Manifest: Code: Copy CreateResource(values, strings.xml, <resources> <string name="accessibility_description">Some Text, Some more text</string> </resources> ) The problem is the "," in the text. I think the CreateResource function thinks that there starts another parameter. How can I create such strings? Is there something like an escape character?
Hello, I'm trying to create something like this in the Manifest: Code: Copy CreateResource(values, strings.xml, <resources> <string name="accessibility_description">Some Text, Some more text</string> </resources> ) The problem is the "," in the text. I think the CreateResource function thinks that there starts another parameter. How can I create such strings? Is there something like an escape character?
eps Expert Licensed User Longtime User Mar 15, 2017 #2 As you're adding XML try this https://www.dvteclipse.com/document...e_special_characters_in_XML.3F.html#gsc.tab=0 Upvote 0
As you're adding XML try this https://www.dvteclipse.com/document...e_special_characters_in_XML.3F.html#gsc.tab=0
stevel05 Expert Licensed User Longtime User Mar 15, 2017 #3 Can't find comma specifically. but it looks like a '\' is an escape character, worth a try. https://developer.android.com/guide/topics/resources/string-resource.html#FormattingAndStyling or put the whole string in quotes. Upvote 0
Can't find comma specifically. but it looks like a '\' is an escape character, worth a try. https://developer.android.com/guide/topics/resources/string-resource.html#FormattingAndStyling or put the whole string in quotes.
corwin42 Expert Licensed User Longtime User Mar 15, 2017 #4 eps said: As you're adding XML try this https://www.dvteclipse.com/document...e_special_characters_in_XML.3F.html#gsc.tab=0 Click to expand... Thanks. Replacing the comma with , works. But I guess this is somehow a workaround for a CreateResource limitation. I'm sure you won't have to do it in an XML file. stevel05 said: Can't find comma specifically. but it looks like a '\' is an escape character, worth a try. Click to expand... I tried a backslash but the problem is that the Syntax parser breaks up the parameter at the comma and a backslash is of no help in this case. Upvote 0
eps said: As you're adding XML try this https://www.dvteclipse.com/document...e_special_characters_in_XML.3F.html#gsc.tab=0 Click to expand... Thanks. Replacing the comma with , works. But I guess this is somehow a workaround for a CreateResource limitation. I'm sure you won't have to do it in an XML file. stevel05 said: Can't find comma specifically. but it looks like a '\' is an escape character, worth a try. Click to expand... I tried a backslash but the problem is that the Syntax parser breaks up the parameter at the comma and a backslash is of no help in this case.
DonManfred Expert Licensed User Longtime User Mar 15, 2017 #5 Maybe Source Code: Copy If you have an apostrophe (') in your string, you must either escape it with a backslash (\') or enclose the string in double-quotes (""). For example, here are some strings that do and don't work: <string name="good_example">This\'ll work</string> <string name="good_example_2">"This'll also work"</string> <string name="bad_example">This doesn't work</string> <!-- Causes a compile error --> Did you tried to enclose the String (including comma) with quotes (")? Code: Copy CreateResource(values, strings.xml, <resources> <string name="accessibility_description">"Some Text, Some more text"</string> </resources> ) Upvote 0
Maybe Source Code: Copy If you have an apostrophe (') in your string, you must either escape it with a backslash (\') or enclose the string in double-quotes (""). For example, here are some strings that do and don't work: <string name="good_example">This\'ll work</string> <string name="good_example_2">"This'll also work"</string> <string name="bad_example">This doesn't work</string> <!-- Causes a compile error --> Did you tried to enclose the String (including comma) with quotes (")? Code: Copy CreateResource(values, strings.xml, <resources> <string name="accessibility_description">"Some Text, Some more text"</string> </resources> )
corwin42 Expert Licensed User Longtime User Mar 15, 2017 #6 DonManfred said: Code: Copy CreateResource(values, strings.xml, <resources> <string name="accessibility_description">"Some Text, Some more text"</string> </resources> ) Click to expand... Yep. The comma is still a problem. Upvote 0
DonManfred said: Code: Copy CreateResource(values, strings.xml, <resources> <string name="accessibility_description">"Some Text, Some more text"</string> </resources> ) Click to expand... Yep. The comma is still a problem.
S sorex Expert Licensed User Longtime User Mar 15, 2017 #7 there's also the CDATA method that's used for content where you're not sure of what it might contain. Upvote 0
there's also the CDATA method that's used for content where you're not sure of what it might contain.
Erel B4X founder Staff member Licensed User Longtime User Mar 16, 2017 #8 , is a special character in the manifest editor. You need to escape it: Code: Copy CreateResource(values, strings.xml, <resources> <string name="accessibility_description">"Some Text,, Some more text"</string> </resources> ) Upvote 1
, is a special character in the manifest editor. You need to escape it: Code: Copy CreateResource(values, strings.xml, <resources> <string name="accessibility_description">"Some Text,, Some more text"</string> </resources> )