作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想将字符串转换为“asdfgh”而不是“2345”,我知道我们可以使用以下方法转换“2345”: Integer.parseInt("stringOfNumber");但我必须将“asdfgg”转换为java中的整数值。
请帮助我。
提前致谢。
最佳答案
使用方法hashCode ,这将根据文档返回任何字符串的 int 值。
Returns a hash code for this string. The hash code for a String object is computed as
s[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1]
using int arithmetic, where s[i] is the ith character of the string, n is the length of the string, and ^ indicates exponentiation. (The hash value of the empty string is zero.)
关于java - 将 "asdfgh"等字符串转换为整数值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10984832/
很难说出这里问的是什么。这个问题是含糊的、模糊的、不完整的、过于宽泛的或修辞性的,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开它,visit the help center 。 已关
我是一名优秀的程序员,十分优秀!