Skip to content

Latest commit

 

History

History
23 lines (18 loc) · 545 Bytes

ascii-to-string.md

File metadata and controls

23 lines (18 loc) · 545 Bytes
title description author tags
Ascii To String
Converts a list of ascii numbers into a string
Mcbencrafter
string,ascii,encoding,decode,conversion
import java.util.List;

public static String asciiToString(List<Integer> asciiCodes) {
    StringBuilder text = new StringBuilder();

    for (int asciiCode : asciiCodes) {
        text.append((char) asciiCode);
    }

    return text.toString();
}

// Usage:
System.out.println(asciiToString(List.of(104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100))); // "hello world"