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