提交 | 用户 | 时间
|
1ab119
|
1 |
package com.iailab.module.model.common.utils; |
D |
2 |
|
|
3 |
/** |
|
4 |
* @description: |
|
5 |
* @author: dzd |
|
6 |
* @date: 2025/2/19 16:22 |
|
7 |
**/ |
|
8 |
public class ASCIIUtil { |
|
9 |
|
|
10 |
/** |
|
11 |
* @description: String 转 ASCII码double[] |
|
12 |
**/ |
|
13 |
public static double[] stringToAsciiArray(String str) { |
|
14 |
int length = str.length(); |
|
15 |
double[] asciiArray = new double[length]; |
|
16 |
// 遍历字符串中的每个字符 |
|
17 |
for (int i = 0; i < length; i++) { |
|
18 |
// 获取当前字符的 ASCII 码值 |
|
19 |
asciiArray[i] = str.charAt(i); |
|
20 |
} |
|
21 |
return asciiArray; |
|
22 |
} |
|
23 |
} |