|
|
|
|
|
by imaginenore
3448 days ago
|
|
I know PHP isn't very popular here, but it's awesome for string manipulation, parsing files. One-line that reads the file, splits multiple lines into an array: <?php
$l = explode("\n", file_get_contents("in.txt"));
Want to sort them alphabetically? Add sort($l);
Trim them? $trimmed = array_map(trim, $l);
Remove duplicates? $unique = array_unique($trimmed);
|
|