Skip to content

Code from the sideline

  • About
  • Twitter
  • GitHub
  • Mastodon

Category: Hello

Interpret a comma seperated list of ints as a string

Getting input like 100,101,102,103 and knowing it is supposed to represent characters but all you have is the bytes can be annoying, so here we go a quick way of writing it out as a text file.

File.open("out.txt", "w") do |f|
  content = File.open("bytes.csv").read
  f.write(content.split(",").map(&:to_i).pack("c*"))
end
sideshowcoder Hello, Uncategorized Leave a comment 06/03/201906/03/2019 1 Minute

Author: Philipp Fehre

Create a website or blog at WordPress.com
  • Follow Following
    • Code from the sideline
    • Already have a WordPress.com account? Log in now.
    • Code from the sideline
    • Customise
    • Follow Following
    • Sign up
    • Log in
    • Report this content
    • View site in Reader
    • Manage subscriptions
    • Collapse this bar
Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy