Skip to content

Commit d7651d1

Browse files
committed
main
1 parent 3810cd3 commit d7651d1

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

docs/document/Powershell/docs/Language/Array.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,11 +184,13 @@ using namespace System.Collections.Generic
184184

185185
Keyword operators has special functionalities on collections.
186186
`-match`, `-notmatch`, `-replace`, `-split` handles for all items in the left operand collection, the result is always an array.
187+
If the item is not a string, Powershell evaluates it to string by certain strategy.
187188

188189
```ps1
189190
# Returns items that matches the regex
190191
@('John', 'Jane', 'Janet') -match 'Jane' # Jane, Janet.
191-
(@('John', 'Jane', 'Janet') -notmatch 'Jane') -is [array] # True, only John matches and still an array.
192+
(gci -file) -match '.*txt$' # FileInfo[], files with FullName matches to the pattern
193+
(@('John', 'Jane', 'Janet') -notmatch 'Jane') -is [Array] # True, only John matches and still an array.
192194
193195
@('John', 'Jane', 'Janet') -replace 'J','K' # Kohn Kane Kanet
194196
'1,2,3','1,2,3' -split ',' # 1 2 3 1 2 3, strings

docs/document/Powershell/docs/Language/Control Flow.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
- Empty string
88
- Numeric zeros
99
- Empty collections implemented `IList`.
10+
- Single-item collection that contains falsy value, `@(0)`, `@($null)` for example.
1011

1112
> [!NOTE]
1213
> You can cast falsy values to boolean.

0 commit comments

Comments
 (0)