T
T
thelastride2020-10-20 09:30:13
ruby
thelastride, 2020-10-20 09:30:13

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 question

Ask a Question

731 491 924 answers to any question