js中trim函数_30天中的30个Excel函数:03 – TRIM

js中trim函数

Yesterday, in the 30XL30D challenge, we took a poke at the lazy brother-in-law function -- AREAS. It's not used much in the working world, but you saw how the 3 reference operators work, so I hope that was useful!

昨天,在30XL30D挑战赛中,我们a了懒惰的brother子功能-AREAS 。 它在工作环境中使用不多,但是您看到了3个引用运算符的工作原理,所以我希望这很有用!

For day 3 in the challenge, we'll examine the TRIM function. In January, some people are trying to TRIM a few pounds, and my Excel Calorie Counter and Excel Weight Loss Tracker workbooks are popular.

对于挑战的第3天,我们将检查TRIM功能。 一月份,有人尝试将磅重调整为几磅,而我的Excel卡路里计数器Excel减肥追踪器工作簿很受欢迎。

Unfortunately, the TRIM function won't help with the pounds, but can remove extra spaces from a text string.

不幸的是,TRIM函数对英镑没有帮助,但是可以从文本字符串中删除多余的空格。

NOTE: You can have all of the 30 Functions content in an easy-to-use single reference file -- the 30 Excel Functions in 30 Days eBook Kit ($10).

注意:您可以在一个易于使用的单个参考文件中获得这30个函数的全部内容-30天电子书工具包中30个Excel函数 (10美元)。

So, let's take a look at the TRIM information and examples, and if you have other tips or examples, please share them in the comments. And good luck with the calorie counting!

因此,让我们看一下TRIM信息和示例,如果还有其他提示或示例,请在评论中分享。 祝您好运!

功能03:TRIM (Function 03: TRIM)

The TRIM function removes all the spaces in a text string, except for single spaces between words.

TRIM函数删除文本字符串中的所有空格,单词之间的单个空格除外。

Trim00

您如何使用TRIM? (How Could You Use TRIM?)

The TRIM function can help with the cleanup of text that you've downloaded from a website, or imported from another application. The TRIM function:

TRIM功能可以帮助清除从网站下载或从其他应用程序导入的文本。 TRIM功能:

  • Removes spaces from start and end of text string

    删除文本字符串开头和结尾的空格
  • Removes all except single spaces between words

    删除单词之间除空格以外的所有空格
  • Does NOT remove some special space characters copied from websites

    不删除从网站复制的一些特殊空格字符

TRIM语法 (TRIM Syntax)

The TRIM function has the following syntax:

TRIM函数具有以下语法:

    • text is a cell reference or text string from which you want spaces removed.

      text是要删除空格的单元格引用或文本字符串。

    TRIM(text)

    TRIM(文字)

修剪陷阱 (TRIM Traps)

The TRIM function only removes standard space characters from the text. If you copy text from a website, it might contain special non-breaking space characters, and the TRIM function will not remove those.

TRIM函数仅从文本中删除标准空格字符。 如果从网站复制文本,则该文本可能包含特殊的不间断空格字符,并且TRIM函数不会删除这些字符。

示例1:从文本字符串的开头和结尾删除空格 (Example 1: Removes spaces from start and end of text string)

You can use the TRIM function to remove all the space characters at the start and end of a text string. In the screenshot below, there are 2 extra spaces at the start and 2 at the end of the text in cell C5.

您可以使用TRIM函数删除文本字符串开头和结尾的所有空格字符。 在下面的屏幕快照中,单元格C5中的文本开头有2个多余空格,文本末尾有2个空格。

The TRIM function in cell C7 removes those 4 spaces.

C7单元格中的TRIM函数删除了这4个空格。

=TRIM(C5)

= TRIM(C5)

Trim01

示例2:删除单词之间除单个空格外的所有空格 (Example 2: Removes all except single spaces between words)

You can use the TRIM function to extra space characters between words in a text string. In the screenshot below, there are 3 extra spaces between the words in cell C5.

您可以使用TRIM函数在文本字符串中的单词之间多余空格。 在下面的屏幕截图中,单元格C5中的单词之间有3个多余的空格。

The TRIM function in cell C7 removes those extra spaces, as well as the 2 spaces at the start and 2 spaces at the end of the text string.

C7单元格中的TRIM函数将删除那些多余的空格,以及文本字符串开头的2个空格和结尾的2个空格。

=TRIM(C5)

= TRIM(C5)

Trim02

示例3:不删除一些空格字符 (Example 3: Does NOT remove some space characters)

The TRIM function does NOT remove some space characters, such as a non-breaking space copied from a website. In the screenshot below, Cell C5 contains one non-breaking space, and that is not trimmed.

TRIM函数不会删除某些空格字符,例如从网站复制的不间断空格。 在下面的屏幕截图中,单元格C5包含一个不间断的空间,并且未进行修剪。

=TRIM(C5)

= TRIM(C5)

You can manually delete the non-breaking space character, or use the SUBSTITUTE function or a macro. You'll see other ways to clean up your data during the 30 Excel Functions in 30 Days challenge.

您可以手动删除不间断空格字符,或使用SUBSTITUTE函数或宏。 在30天的30个Excel函数中,您将看到其他清除数据的方法。

Trim03

下载TRIM功能文件 (Download the TRIM Function File)

To see the formulas used in today's examples, you can download the TRIM function sample workbook. The file is zipped, and is in Excel 2007 file format.

要查看当今示例中使用的公式,可以下载TRIM函数示例工作簿 。 该文件已压缩,并且为Excel 2007文件格式。

观看TRIM视频 (Watch the TRIM Video)

To see a demonstration of the examples in the TRIM function sample workbook, you can watch this short Excel video tutorial.

要观看TRIM函数示例工作簿中示例的演示,您可以观看这段简短的Excel视频教程。

演示地址

翻译自: https://contexturesblog.com/archives/2011/01/04/30-excel-functions-in-30-days-03-trim/

js中trim函数

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值