Skip to content

Instantly share code, notes, and snippets.

@jeremycochoy
Created February 21, 2019 17:01
Show Gist options
  • Save jeremycochoy/3e5b8e791e730422c24009fbb9c0f0c4 to your computer and use it in GitHub Desktop.
Save jeremycochoy/3e5b8e791e730422c24009fbb9c0f0c4 to your computer and use it in GitHub Desktop.
Split strings back into smaller chunks
coordinates = []
word = ""
polyline.each_byte do |b|
# Add the character b to the current chunk
word << b
next unless b < 0x5f # While we are below the _ ascii code
# Add the chunk to the list of coordinates represented by a string
coordinates << word
word = ""
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment