TrimAll
Returns a copy of text with specified spaces removed or inserted.
Format
TrimAll ( text ; trimSpaces ; trimType )
Parameters
text
- any text expression or text field
trimSpaces
- 0 or False, 1 or True
trimType
- 0 through 3 depending on the trim style that you wish to use
Data type returned
text
Originated in version
6.0 or earlier
Description
Use TrimAll to work with spaces between text or non-roman spaces such as full- and half-width spaces; otherwise, use the Trim function.
Set trimSpaces
to True (1) if you want to remove full-width spaces. Set trimSpace
to False (0) if you want to keep full-width spaces.
A character is considered roman if its Unicode value is less than U+2F00. Any character whose Unicode value is greater than or equal to U+2F00 is considered non-roman.
Characters within the roman range are those belonging to the following character blocks: Latin, Latin-1 Supplement, Latin Extended-A & B, IPA Extensions, Spacing Modifier Letters, Combining Diacritical Marks, Greek, Cyrillic, Armenian, Hebrew, Arabic, Devanagari, Bengali, Gurmukhi, Gujarati, Oriya, Tamil, Telugu, Kannada, Malayalam, Thai, Lao, Tibetan, Georgian, Hangul Jamo, and additional Latin and Greek extended blocks.
Symbols within the roman range include punctuation characters, superscripts, sub-scripts, currency symbols, combining marks for symbols, letter-like symbols, number forms, arrows, math operators, control pictures, geometric shapes, dingbats, and so on.
Characters within the non-roman range are those belonging to the CJK symbols/punctuations area, Hiragana, Katakana, Bopomofo, Hangul compatibility Jamo, Kanbun, CJK unified ideographs, and so on.
Spaces are removed or inserted depending on the value of trimType,
as given in the following tables:
This |
Does this |
0 |
Removes all spaces between non-roman and roman characters (always leave one space between roman words). |
1 |
Always includes a half-width space between non-roman and roman characters (always leave one space between roman words). |
2 |
Removes spaces between non-roman characters (reduce multiple space between non-roman and roman words to 1 space; do not add spaces if there are none; always leave one space between roman words). |
3 |
Removes all spaces everywhere. |
In all cases, spaces between non-roman characters are removed.
Type |
Non-roman - Non-roman |
Non-roman - roman |
Roman - roman |
0 |
Remove |
Remove |
1 space |
1 |
Remove |
1 space* |
1 space |
2 |
Remove |
1 space |
1 space |
3 |
Remove |
Remove |
Remove |
* = insert space between non-roman and roman text if there isn’t one.
Notes
- Full-width spaces are only present in some non-roman languages, such as Japanese. If you only use roman languages, set
trimSpaces
to False (0).
Example 1
TrimAll(" Julian Scott Dunn ";0;0) returns Julian Scott Dunn.
Example 2
TrimAll() returns if the value of field is .
Example 3
TrimAll() returns .