words()

Read(2996) Label: extract, string, english letters,

Here’s how to use words() functions.

s. words()

Description

Extract English letter strings from a string.

Syntax

s.words()

Note

The function returns a string sequence consisting of English letters extracted from string s while other characters are ignored if no options are present.

Option

@d

Extract digits from a string.

@a

Extract both English letter strings and substrings of digits from a string.

@c

Extract English letter strings, numeric strings and Chinese characters from a string.

@w

Extract all characters: a string in Chinese /a sign will be extracted as individual characters and a string of English letters/a number as words.

@p

Use with @w option to identify the beginning part of a number or a datetime data as a part of it.

@i

Treat continuous English letters plus digits as a whole.

Treat continuous English letters, numbers and Chinese characters as a whole when this option works with @c option.

Parameter

s

A string.

Return value

A sequence of strings

Example

 

A

 

1

4,23,a,test?my_file 57

 

2

=A1.words()

Extract English letter strings from the string:

3

=A1.words@d()

Extract digits form the string:

4

=A1.words@a()

Extract English letter strings and digits form the string:

5

abc123好吗#?df34

 

6

=A5.words@w()

7

=A5.words@i()

Extract English letters in a row and continuous English letters plus digits as a whole:

8

hi*-10hello2020-01-01go3.1415926

 

9

=A8.words@w()

10

=A8.words@wp()

The beginning part of a digit or date is recognized as a part of a whole number or date data, like one in -10, 2020-01-01 and 3.1415926, according to the data type:

 

When string s contains Chinese characters:

 

A

 

1

abc123好吗c#?df34

 

2

=A1.words()

Only extract English letter strings as no options are present:

3

=A1.words@a()

Use @a option to extract English letter strings and numeric strings: 

4

=A1.words@c()

Use @c option to extract English letter strings, numeric strings and Chinesee charactrers:

5

=A1.words@i()

Use @i option to treat continuous English letters and numbers as a whole:

6

=A1.words@ic()

The presence of options @ic enables treating continusous English letters, numbers and Chinese characters as a whole: