有没有办法验证 Salesforce ID,也许使用 RegEx?它们通常是 15 个字符或 18 个字符,但它们是否遵循我们可以用来检查它是否是有效 ID 的模式。
验证 salesforce ID 有两个级别:
- 使用正则表达式检查格式
[a-zA-Z0-9]{15}|[a-zA-Z0-9]{18}
- for 18-characted ids you can check the the 3-character checksum https://astadiaemea.wordpress.com/2010/06/21/15-or-18-character-ids-in-salesforce-com-%E2%80%93-do-you-know-how-useful-unique-ids-are-to-your-development-effort/:
注释中提供的代码示例:
- C# https://gist.github.com/jeriley/36b29f7c46527af4532aaf092c90dd56
- Go https://gist.github.com/maxmcd/a32a35c0eebcfb77cd005f9dd8958815
- JavaScript https://gist.github.com/step307/3d265b7c7cb4eccdf0cf55a68c9cfefa
- Ruby https://gist.github.com/alfius/3bd51d4bc0796185a9d1f7a7841507d0
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)