2

Having a couple issues with this. I'm using a sample Android XML file, and this is the line it uses <string name="search_results">\'<xliff:g id="string">%s</xliff:g>\'</string> which outputs: 'mystring'

I want it to output just mystring, without the quotes. If I take out the quotes in the xml file, I get s as the output. If I take out just one, I either get s' or 'mystring, depending on which mark is taken out. To be clear, I am literally getting the letter 's' as the output.

I couldn't find a simple tutorial on this, I figure one of you will know pretty quickly.

Thanks!

2 Answers 2

3

Did you happen to try:

<string name="search_results"><xliff:g id="string">%s</xliff:g></string>
Sign up to request clarification or add additional context in comments.

2 Comments

You are a magical genius, thank you. I'll mark this page so I can come vote you up when I get enough reputation :)
@ahmet alp balkan. Thanks, figured out how to do that and did :)
1

What if you take the output with the quotes 'mystring' and then run that through a method that removes the quotes? Something like this:

public String removeQuotes(String value){
    if(value.startsWith("\'"){
        value = value.substring(1, value.length());
    }

    if(value.endsWith("\'"){
        value = value.substring(0, value.length()-1);
    }

    return value;

}

not sure if that would be feasible solution for you or not but it could be a temp fix if anything.

That code might not work 100% [I'm a tad rusty] just wanted to give an idea though. Hope it helps.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.