M
M
Morfeey2017-02-08 14:16:15
PHP
Morfeey, 2017-02-08 14:16:15

Special line division, how to organize?

In general, there is a certain number of lines in which several words are written, which are not separated by anything other than the case of the initial letter. I figured out how to separate the words themselves, but in the end it turns out that the very first character that is also needed is cut off.
This is how I divided them:

preg_split( "([A-Z])", "ClothArmor51Mag_1");   //Array ( [0] => [1] => loth [2] => rmor51 [3] => ag_1 )

The result is the following:
The letters "C", "A", "M" are eaten.
Help)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
WQP, 2017-02-08
@Morfeey

$text = 'ClothArmor51Mag_1';
preg_match_all("/[A-Z][^A-Z]*?/Us", '$text', $output_array);
print_r($output_array);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question