Shurikan117
Shurikan117

Reputation: 105

Entering a string with over 900,000+ characters

Using 'gets' only uses like half (or less) of the entered string. Is there a way to load the string? (It's 900,000+ characters long)

Upvotes: 0

Views: 66

Answers (1)

Jyrki
Jyrki

Reputation: 568

The easiest way to work around this limitation of gets is to store that 900k character string into a file and then use File.read to read it:

very_long_string = File.read("./900k_chars")

Upvotes: 3

Related Questions