首页 \ 问答 \ 特殊字符删除?(Special characters remove?)

特殊字符删除?(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?

更新时间:2023-03-21 18:03

最满意答案

尝试

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 ...
  • 尝试 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 ...
  • 只需删除逗号: 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 ...

相关文章

更多

最新问答

更多
  • 在javascript中创建类以创建对象并在Java中创建类和对象之间的区别(Difference between creating a class in javascript to create an object and creating an class and object in Java)
  • Facebook API:将身份验证详细信息从Javascript SDK发送到PHP SDK(Facebook API: Send authentication detail from Javascript SDK to PHP SDK)
  • 如何停止队列动画jquery?(How can I stop queue animation jquery?)
  • 使用C#的井字游戏中的人工智能(Artificial Intelligence in Tic-Tac-Toe using C#)
  • 多少流量可以共享虚拟主机(对于Python Django站点)支持?(How Much Traffic Can Shared Web Hosting (for a Python Django site) support?)
  • 带有CIFilters的CAShapeLayer(CAShapeLayer with CIFilters)
  • 如何在Angular 2中读取JSON #text(How to read in Angular 2 the JSON #text)
  • 如何在xml中读取自闭标签的属性?(How to read self closing tag's attribute in xml?)
  • 无法使用http put将图像上传到亚马逊S3(Cannot upload image to amazon s3 using http put)
  • 文件结束无限循环(end of file infinite while-loop)
  • 在cpp的模板(template in cpp)
  • 在构建库时,clang和clang ++有什么区别?(What's the difference between clang and clang++ when building a library?)
  • ng类中的表达式(expression inside ng-class)
  • 在PHP中获取随机布尔值true / false(Get random boolean true/false in PHP)
  • 管道的高效分块用于严格的字节串(Efficient chunking of conduit for strict bytestring)
  • Python ternary_operator(如果其他标志做了其他操作,则执行其他操作)(Python ternary_operator (do-somthing if flag else do-another))
  • Sencha Touch面具发布(Sencha Touch mask ondisclosure)
  • 验证脚本上的通知[重复](Notices on validation script [duplicate])
  • 朋友功能(friend function)
  • 基于角坐标平移和变换平面几何(Translate and transform plane geometry based on corner coordinates)
  • Rails:'如果在本地运行'条件javascript标记包括(Rails: 'if running locally' conditional javascript tag include)
  • 解压文件(Unzipping files)
  • 使用ui-router以角度加载变量状态(loading in variable states with ui-router in angular)
  • 创建Azure云服务需要多长时间?(how long does it take to create an Azure Cloud Service? How to view log information?)
  • 指向整数的指针数组(Array of pointers to integers)
  • Laravel服务提供商没有看到我的包的主要类(Laravel service provider does not see the main class of my package)
  • 这个关于VSS / RSS / PSS / USS的解释是否准确?(Is this explanation about VSS/RSS/PSS/USS accurate?)
  • 在Django-Admin中通过row-id排序显示项目(Ordering the display items by row-id in Django-Admin)
  • 如何使用cythonize启用`--embed`?(How to enable `--embed` with cythonize?)
  • 用于将文本多行设置的Excel脚本(Excel script for ereasing text multiple rows)