A
A
Astral1004982020-09-25 14:08:44
PHP
Astral100498, 2020-09-25 14:08:44

How to clear a tab from a line?

There is a line like this:

let stroka = '<a href="/video">
            <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" viewBox="0 0 21 14" width="21" height="14" style="position: relative; top: -2px; margin-right: 7px; margin-left: 2px;">
              <path d="M12.257 0H1.743C.78 0 0 .78 0 1.743v10.514C0 13.22.78 14 1.743 14h10.514C13.22 14 14 13.22 14 12.257V1.743C14 .78 13.22 0 12.257 0zm6.906 1.374l-3.996 2.757v5.738l3.996 2.753c.772.532 1.837-.011 1.837-.94V2.314c0-.926-1.06-1.473-1.837-.94z" fill="currentColor"></path>
            </svg>
            Видеоуроки</a>
        </li>'


How to remove tabs and line breaks? To make it look like this: .......</svg>Видеоуроки</a</li>'.........

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ivanq, 2015-11-24
@Ivanq

Old PHP doesn't understand code like this:
It gets in the way of getting an array element right after the function call. Treat like this:
In your code:

/* 50: */
$fetchparts = $this->mail_fetchparts($this->Mail, $num);
$obj["Body"] = trim(imap_base64($fetchparts[abs($this->html)]));

/* 78: */
$exploded = explode(";", $headers["Received"][0]);
$hdr["Date"] = date("H:i:s d-m-Y", strtotime(trim($exploded[1])));

A
Alexey Yarkov, 2020-09-25
@Astral100498

stroka.replace(/[\r\n\t]+/g, '').trim()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question