Answer the question
In order to leave comments, you need to log in
How to shorten a string by n characters in a Ruby array?
Hello.
I have one array which consists of data like "TestA: TestA, TestB: TestB" (It is divided into : and ,).
Data is read and output using the map_array function (map_array['TestA']).
The question is how to shorten a string from an array by n lines. That is, I would like to get map_array['TestA'] = Tes (for example). But at the same time without touching the array itself.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question