字符串文本转长值
嗯,就是这样! 我需要将字符串文本(如“Hrd$457”)转换为长值。 黑莓 IDE 有一个按钮可以执行此操作,但我需要通过代码执行此操作。 请注意,该字符串是字母数字。
谢谢!
笔记: 抱歉,如果我的问题不太清楚。我所说的 IDE 按钮将整个字符串转换为长值,使该字符串成为唯一的数字。 BlackBerry 文档称:
“要创建唯一的长密钥,请在 BlackBerry® Integrated Development Environment 中键入字符串值。 com.rim.samples.docs.userinfo 右键单击该字符串,然后单击“将 'com.rim.samples.docs.userinfo' 转换为长整型”。”
因此,我需要执行完全相同的操作,但是通过代码。
我非常感谢您的帮助伙伴,非常感谢您的尝试帮助。
Well, thats it!
I need to convert a string text (like"Hrd$457"), into a long value.
The blackberry IDE has a button that do it, but i need do this by code.
Please note that the string is alpha numeric.
THX!
NOTE:
Sorry if my question was not really clear. The IDE button that im talkin about converts the entire string in a long value that makes that string a unique number. The BlackBerry documentation says:
"To create a unique long key, in the BlackBerry® Integrated Development Environment, type a string value.
com.rim.samples.docs.userinfo
Right-click the string and click Convert ‘com.rim.samples.docs.userinfo’ to long."
So, i need to do exactly the same but by code.
I really appreciate your help buddies, and thanks so much for trying to help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
如果您只是寻找字符串的数字常量,您可以执行以下操作。
If you are just looking for a number constant for a string you can do the following.
以长整型形式返回 SHA1 摘要的前 8 个字节。使用 BlackBerry JDE,可以通过突出显示字符串、右键单击并从上下文菜单中选择“Convert '' to long”以交互方式获得相同的结果。
Returns the first 8 bytes of a SHA1 digest as a long. The same result can be obtained interactively using the BlackBerry JDE by highlighting a string, right-clicking, and choosing "Convert '' to long" from the context menu.
这是另一种方法。如果有多个数字,您可以使用扫描仪循环遍历字符串。
This is another approach. If there are multiple numbers you can loop through the String using the scanner.
不确定我完全理解你的例子,但这怎么样?
Not sure I fully grasp your example, but how's this?