特殊字符删除?(Special characters remove?)
如何从顶点中的字符串中删除特殊字符。
代码:selectedStatus = ApexPages.currentPage()。getParameters()。get('ideaStatus');
价值:ideastatus =“我们喜欢它”
我想从ideastatus的价值中删除'。
我正在尝试selectedStatus.replace(“'”,“”);
但它不起作用。
谁能建议怎么样?
How to remove special characters from a string in apex.
Code: selectedStatus = ApexPages.currentPage().getParameters().get('ideaStatus');
value: ideastatus = "We like's it"
I want to remove the ' from the value of ideastatus.
I am trying selectedStatus.replace("'","");
But its not working.
Can anybody suggest how?
最满意答案
尝试
selectedStatus.replace('\'', '')
但请注意,“我们喜欢它”在语法上是不正确的 - 它应该是“我们喜欢它”。 所以你不必担心这种情况下的撇号。
Try
selectedStatus.replace('\'', '')
However please note that "We like's it" is grammatically incorrect - it should be "We like it". So you shouldn't have to worry about the apostrophe in this case.
相关问答
更多-
尝试这个: rename = name.replace(/[[\]{}<>]/g, ""); Try this: rename = name.replace(/[[\]{}<>]/g, "");
-
在角色组中添加一个点。 /[^\p{LN}\-.]/u <-- see the dot Add a dot to your character group. /[^\p{LN}\-.]/u <-- see the dot
-
MySQL不支持这样的查询。 您在MySQL查询中的最佳镜头有很多以下内容: update TABLENAME set FIELDNAME = replace(FIELDNAME,'_','') MySQL doesn't support such a query. Your best shot within a MySQL query is a lot of the following: update TABLENAME set FIELDNAME = replace(FIELDNAME,'_','') ...
-
placeAnnotation.mapItem.phoneNumber!.components(separatedBy: CharacterSet.decimalDigits.inverted) .joined() 干得好! 我测试并且运行良好。 placeAnnotation.mapItem.phoneNumber!.components(separatedBy: CharacterSet.decimalDigits.inverted) .joined() Here you go! I ...
-
特殊字符删除?(Special characters remove?)[2023-03-21]
尝试 selectedStatus.replace('\'', '') 但请注意,“我们喜欢它”在语法上是不正确的 - 它应该是“我们喜欢它”。 所以你不必担心这种情况下的撇号。 Try selectedStatus.replace('\'', '') However please note that "We like's it" is grammatically incorrect - it should be "We like it". So you shouldn't have to worry ... -
如果您只想保留带有字母字符的行(如OP所要求的那样),那么: $ grep -v '[^a-zA-Z]' foo 或者如果你只想要英文字符: $ grep -v '[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ]' foo 但是,如果你只是想删除非alpha字符, sed将完成这项工作: $ cat foo | sed 's/[^a-zA-Z]//g' 或者,如果您只想杀死二进制 ,不可打印的数据,请使用字符串: $ strings foo ...
-
你错过了逃脱^ 。 为了避免这种情况,需要一个\ ,但由于C字符串,还需要进行转义。 你还想要一个或多个出现与+匹配。 这个正则表达式应该有效: [\\^$]+ , 请参阅在线 。 所以它必须是: QString str = "^TEST$^TEST$"; str = str.remove(QRegularExpression("[\\^$]+")); Joe P在下面评论中提到的另一种可能性是: QString str = "^TEST$^TEST$"; str = str.remove(QRegula ...
-
VBA删除特殊字符(VBA Remove special characters)[2022-12-03]
只需删除逗号: If b$ Like "[A-Za-z0-9]" Then 正如在MSDN for Visual Basic 上所说: 要为同一个字符位置指定多个范围,请将它们放在不带分隔符的相同括号中。 例如,如果字符串中的相应字符位置包含范围A-C或范围X-Z内的任何字符,则[A-CX-Z]将导致匹配。 虽然MSDN没有特别提及VBA,但它显示了相同的行为。 Just remove the commas: If b$ Like "[A-Za-z0-9]" Then As it says on MSD ... -
使用preg_replace函数的解决方案: $arr = ['users' => ['name' => 'ASSOCIATION OF�CHIEFS OF USERS']]; $arr['users']['name'] = preg_replace("/[^\w [:punct:]]+/i", " ", $arr['users']['name']); print_r($arr); 输出: Array ( [users] => Array ( [nam ...
-
您可以使用以下代码: abc = "test = > @ Stack overflow" puts abc.gsub(/\s*([^\s\p{L}\p{N}])\s*/, "\\1") 请参阅IDEONE演示 ,结果: test=>@Stack overflow 。 捕获组是恢复捕获的“特殊”字符所必需的。 [^\s\p{L}\p{N}]代表非空格,非字母和非数字字符。 You can use the following code: abc = "test = > @ Stack overflow" pu ...