由网友(氧气邮递员)分享简介:我保存在我的strings.xml文件中的SQL查询,我想用的String.Format 打造code中的最后一个字符串。该 SELECT 语句使用一个像,像这样:I am storing a SQL query in my strings.xml file and I want to use String.Form...
我保存在我的strings.xml文件中的SQL查询,我想用的String.Format
打造code中的最后一个字符串。该 SELECT
语句使用一个像,像这样:
I am storing a SQL query in my strings.xml file and I want to use String.Format
to build the final string in code. The SELECT
statement uses a like, something like this:
SELECT Field1, Field2 FROM mytable WHERE Field1 LIKE '%something%'
为了格式化,我代替'东西'%1 $ s的所以它变成了:
In order to format that I replace 'something' with %1$s so it becomes:
SELECT Field1, Field2 FROM mytable WHERE Field1 LIKE '%%1$s%'
我逃避单引号与反斜杠。但是我不能够逃脱%标志。
I escape the single quotes with the backslash. However I am not able to escape the % sign.
我怎么能包括在我的strings.xml文件中的声明一样?
How can I include a like statement in my strings.xml file?
推荐答案
要逃避%
,你需要加倍起来: %%
。
To escape %
, you will need to double it up: %%
.
相关推荐
最新文章