gpt4 book ai didi

jquery - 指定字符的自定义换行符

转载 作者:太空宇宙 更新时间:2023-11-04 13:37:05 24 4
gpt4 key购买 nike

我希望能够在 @ 符号之后对电子邮件进行分词。

所以它看起来像下面这样

 id | name    | email       | status
--------------------------------------
1 | Bob joe | bjoe | active
| | @gmail.com |
--------------------------------------
2 | jay c | jc@gmail.com| active
--------------------------------------
3 | David | dsmith | inactive
| Smith | @yahoo.com |
^ I want it to break the email right before the @sign

我目前的情况是这样的:

http://jsfiddle.net/9rjW3/

下面是相同的代码:

CSS

table{ 
table-layout:fixed;

-ms-word-break: break-all;
word-break: break-all;
word-break: break-word;

width: 330px;
}

table td{
overflow: hidden;
}

HTML

<table class="fixed" border="1">
<col width="20px" />
<col />
<col />
<col width="70px" />
<tr>
<th>#</th>
<th>Name</th>
<th>Email</th>
<th>status</th>
</tr>
<tr>
<td>1</td>
<td>Kaimana Marek</td>
<td>thisisatest@gmail.com</td>
<td>Active</td>
</tr>
<tr>
<td>2</td>
<td>Joshua Bourguignon</td>
<td>tasdflknadsfl@gmail.com</td>
<td>Inactive</td>
</tr>
<tr>
<td>3</td>
<td>Ekkehard Mehmud</td>
<td>asdflknasdc@yahoo.com</td>
<td>Active</td>
</tr>
</table>

是否可以使用自定义字符(如 @ 符号)对字符串进行换行?

最佳答案

类似于 s.replace(/([^\n]{10})/g, '$1\n'); 其中 {10} 是您要在其后添加分隔符的字符数。

此外,为了使其看起来一致,最好使用等宽字符,否则字符的宽度会发生很大变化。

关于jquery - 指定字符的自定义换行符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22971297/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com