Powershell, 18(削除) 18 (削除ここまで) 12 bytes
$args|% t*y|%{' '}
-6 bytes thanks @Julian
$args|%{' '}
The expression % t*ysplits input strings into chars. This solution has same length as solution in the Matt's comment : " "*"$args".length.Try it online!
Testscript (use LF only mode in your editor):
$f = {
$args|% t*y|%{' '}
}
@(
,(13, "Hello, World!")
,(2, "Hi")
,(45, " Don't
Forget about
Existing
Whitespace! ")
,(0, "")
,(13, " ")
,(1,"
")
) | % {
$len,$source=$_
$r = &$f $source
$l=$r.length
"$($l-eq$len): $l"
}
$f = {
$args|% t*y|%{' '}
}
@(
,(13, "Hello, World!")
,(2, "Hi")
,(45, " Don't
Forget about
Existing
Whitespace! ")
,(0, "")
,(13, " ")
,(1,"
")
) | % {
$len,$source=$_
$r = &$f $source
$l=$r.length
"$($l-eq$len): $l"
}
Output:
True: 13
True: 2
True: 45
True: 0
True: 13
True: 1
True: 13
True: 2
True: 45
True: 0
True: 13
True: 1
Powershell + Regex, 20 bytes
$args-replace'.',' '
$args-replace'.',' '
Powershell, 18 bytes
$args|% t*y|%{' '}
The expression % t*ysplits input strings into chars. This solution has same length as solution in the Matt's comment : " "*"$args".length.
Testscript (use LF only mode in your editor):
$f = {
$args|% t*y|%{' '}
}
@(
,(13, "Hello, World!")
,(2, "Hi")
,(45, " Don't
Forget about
Existing
Whitespace! ")
,(0, "")
,(13, " ")
,(1,"
")
) | % {
$len,$source=$_
$r = &$f $source
$l=$r.length
"$($l-eq$len): $l"
}
Output:
True: 13
True: 2
True: 45
True: 0
True: 13
True: 1
Powershell + Regex, 20 bytes
$args-replace'.',' '
Powershell, (削除) 18 (削除ここまで) 12 bytes
-6 bytes thanks @Julian
$args|%{' '}
Testscript (use LF only mode in your editor):
$f = {
$args|% t*y|%{' '}
}
@(
,(13, "Hello, World!")
,(2, "Hi")
,(45, " Don't
Forget about
Existing
Whitespace! ")
,(0, "")
,(13, " ")
,(1,"
")
) | % {
$len,$source=$_
$r = &$f $source
$l=$r.length
"$($l-eq$len): $l"
}
Output:
True: 13
True: 2
True: 45
True: 0
True: 13
True: 1
Powershell + Regex, 20 bytes
$args-replace'.',' '
Powershell, 18 bytes
$args|% t*y|%{' '}
The expression % t*y splits input strings into chars. This solution has same length as solution in the Matt's comment: " "*"$args".length.
Testscript (use LF only mode in your editor):
$f = {
$args|% t*y|%{' '}
}
@(
,(13, "Hello, World!")
,(2, "Hi")
,(45, " Don't
Forget about
Existing
Whitespace! ")
,(0, "")
,(13, " ")
,(1,"
")
) | % {
$len,$source=$_
$r = &$f $source
$l=$r.length
"$($l-eq$len): $l"
}
Output:
True: 13
True: 2
True: 45
True: 0
True: 13
True: 1
Powershell + Regex, 20 bytes
$args-replace'.',' '
Powershell, 18 bytes
$args|% t*y|%{' '}
The expression % t*y splits input strings into chars. This solution has same length as solution in the Matt's comment: " "*"$args".length.
Testscript (use LF only mode in your editor):
$f = {
$args|% t*y|%{' '}
}
@(
,(13, "Hello, World!")
,(2, "Hi")
,(45, " Don't
Forget about
Existing
Whitespace! ")
,(0, "")
,(13, " ")
,(1,"
")
) | % {
$len,$source=$_
$r = &$f $source
$l=$r.length
"$($l-eq$len): $l"
}
Output:
True: 13
True: 2
True: 45
True: 0
True: 13
True: 1
Powershell, 18 bytes
$args|% t*y|%{' '}
The expression % t*y splits input strings into chars. This solution has same length as solution in the Matt's comment: " "*"$args".length.
Testscript (use LF only mode in your editor):
$f = {
$args|% t*y|%{' '}
}
@(
,(13, "Hello, World!")
,(2, "Hi")
,(45, " Don't
Forget about
Existing
Whitespace! ")
,(0, "")
,(13, " ")
,(1,"
")
) | % {
$len,$source=$_
$r = &$f $source
$l=$r.length
"$($l-eq$len): $l"
}
Output:
True: 13
True: 2
True: 45
True: 0
True: 13
True: 1
Powershell + Regex, 20 bytes
$args-replace'.',' '
Powershell, 18 bytes
$args|% t*y|%{' '}
The expression % t*y splits input strings into chars. This solution has same length as solution in the Matt's comment: " "*"$args".length.
Testscript (use LF only mode in your editor):
$f = {
$args|% t*y|%{' '}
}
@(
,(13, "Hello, World!")
,(2, "Hi")
,(45, " Don't
Forget about
Existing
Whitespace! ")
,(0, "")
,(13, " ")
,(1,"
")
) | % {
$len,$source=$_
$r = &$f $source
$l=$r.length
"$($l-eq$len): $l"
}
Output:
True: 13
True: 2
True: 45
True: 0
True: 13
True: 1