René's URL Explorer Experiment


Title: New Feature: Commands for string methods & operators on the pipeline · Issue #6697 · PowerShell/PowerShell · GitHub

Open Graph Title: New Feature: Commands for string methods & operators on the pipeline · Issue #6697 · PowerShell/PowerShell

X Title: New Feature: Commands for string methods & operators on the pipeline · Issue #6697 · PowerShell/PowerShell

Description: Introduction One of the things I have seen that always bugged me in PowerShell was the fact, that string operators cannot be used on a pipeline. A simple example: (2,3,1,4 | Sort-Object) -join "." Not convenient, especially for interacti...

Open Graph Description: Introduction One of the things I have seen that always bugged me in PowerShell was the fact, that string operators cannot be used on a pipeline. A simple example: (2,3,1,4 | Sort-Object) -join "." ...

X Description: Introduction One of the things I have seen that always bugged me in PowerShell was the fact, that string operators cannot be used on a pipeline. A simple example: (2,3,1,4 | Sort-Object) -join &quo...

Opengraph URL: https://github.com/PowerShell/PowerShell/issues/6697

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"New Feature: Commands for string methods \u0026 operators on the pipeline","articleBody":"# Introduction\r\nOne of the things I have seen that always bugged me in PowerShell was the fact, that string operators cannot be used on a pipeline. A simple example:\r\n```powershell\r\n(2,3,1,4 | Sort-Object) -join \".\"\r\n```\r\nNot convenient, especially for interactive console use where you often need to go back and add the braces. The default string operators obviously aren't cmdlets and won't work on the pipeline - instead they are fast.\r\n\r\nIn one of my modules (`PSUtil`) I have functions that emulate this functionality:\r\n```powershell\r\n2,3,1,4 | sort | join \".\"\r\n```\r\nHowever I think this would make sense as part of the default command set, as virtually every user of PowerShell has to handle strings.\r\n\r\n# Weighing the scales\r\n## Advantages\r\n\r\n - More convenient to use for end user on the pipeline\r\n - Additional suitable features can be added through parameters (See implementation proposal below)\r\n\r\n## Disadvantages\r\n\r\n - Clobber list of commands available by default with more commands.\r\n\r\n# On Implementation\r\n\r\nI am willing to implement all commands involved, their tests and documentation, all by myself, if this feature is deemed worthwhile.\r\n\r\n# Proposed commands \u0026 features\r\n## Add-String (Alias: 'wrap')\r\n\r\nDoes not have an operator equivalent. Command that allows you to easily add to a string on the pipeline.\r\n\r\n### Example\r\n```powershell\r\nPS\u003e 1..4 | wrap '\"' '\"'\r\n\r\n\"1\"\r\n\"2\"\r\n\"3\"\r\n\"4\"\r\n```\r\n\r\n### Parameters\r\n\r\n - InputString (`string[]` | Pipeline), the string(s) being added to\r\n - Before (`string`), the string to add before the input\r\n - Behind (`string`), the string to add behind the input\r\n - PadLeft (`char`), character to pad left with\r\n - PadRight (`char`), character to pad right with\r\n - PadWidth (`int`), up to how many characters the string should be padded with\r\n\r\n## Format-String (Alias: 'format')\r\n\r\nEquivalent to `-f`. Command that allows you to use the format operator on the pipeline.\r\n\r\n### Example\r\n```powershell\r\nPS\u003e 1..4 | format \"{0:N2} - {1:D3}\" -Count 2\r\n\r\n1,00 - 002\r\n3,00 - 004\r\n```\r\n\r\n### Parameters\r\n\r\n - InputObject (`object` | Pipeline), objects to be formatted\r\n - Format (`string`), the format definition\r\n - Count (`int`), the number of items to store up before formating them in bulk (optional, default 1)\r\n\r\n## Get-Substring\r\n\r\nAllows trimming and picking a substring from specified strings.\r\n\r\n### Example\r\n\r\n```powershell\r\nPS\u003e \"abc def ghi\" | substring -trim \"abi\"\r\n\r\nc def gh\r\n\r\nPS\u003e \"abc def ghi\" | substring 2 4\r\n\r\nc de\r\n```\r\n\r\n### Parameters\r\n\r\n - InputString (`string[]` | Pipeline), the strings to pick from\r\n - Trim (`string`), what characters to trim\r\n - TrimStart (`string`), what characters to trim at the start of the string\r\n - TrimEnd (`string`), what characters to trim at the end of the string\r\n - Start (`int`), the start index to pick the substring from\r\n - Length (`int`), how long a substring to pick\r\n\r\n## Join-String (Alias: 'join')\r\n\r\nEquivalent to `-join`. Command that allows you to join items on the pipeline\r\n\r\n### Example\r\n```powershell\r\nPS\u003e 1..4 | join \",\"\r\n\r\n1,2,3,4\r\n\r\nPS\u003e 1..4 | join \",\" -Count 2\r\n\r\n1,2\r\n3,4\r\n```\r\n\r\n### Parameters\r\n\r\n - InputString (`string[]` | Pipeline), the strings to join\r\n - Separator (`string`), what string to join them with. Defaults to `([System.Environment]::NewLine)`\r\n - Count (`int`), the number of items to join together. (Defaults to all items)\r\n\r\n## Set-String ('replace')\r\n\r\nEquivalent to the `-replace` operator _and_ the `.Replace()` string method\r\n\r\n### Example\r\n```powershell\r\nPS\u003e \"abc def ghi\" | replace \"d\\w+\" \"zzz\"\r\n\r\nabc zzz ghi\r\n\r\nPS\u003e \"abc def ghi\" | replace \"d\\w+\" { 1..4 | join \".\" }\r\n\r\nabc 1.2.3.4 ghi\r\n\r\nPS\u003e \"abc (def) ghi\" | replace \"(def)\" \"def\" -DoNotUseRegex\r\n\r\nabc def ghi\r\n```\r\n\r\n### Parameters\r\n\r\n - InputString (`string[]` | Pipeline), the strings to replace within\r\n - OldValue (`string`), what sequence to replace\r\n - NewValue (`object`), what to replace with. Can be a string or a scriptblock\r\n - DoNotUseRegex (`switch`), switches from regex replace to using the string method `Replace()`\r\n - Options (`RegexOptions`), the regex options to use on replace, defaults to `IgnoreCase`\r\n\r\n## Split-String ('split')\r\n\r\nEquivalent to the `-split` operator _and_ the `.Split()` string method\r\n\r\n### Example\r\n\r\n```powershell\r\nPS\u003e \"abc def ghi\" | split \" d\\w+ \"\r\n\r\nabc\r\nghi\r\n\r\nPS\u003e \"abc def ghi | split \" d\\w+ \" -DoNotUseRegex\r\n\r\nabc\r\n\r\nef\r\nghi\r\n```\r\n\r\n### Parameters\r\n\r\n - InputString (`string[]` | Pipeline), the strings to split\r\n - Separator (`object`), what to split with.\r\n - DoNotUseRegex (`switch`), switches from regex split to using the string method `Split()`\r\n - Options (`RegexOptions`), the regex options to use on split, defaults to `IgnoreCase`\r\n - Count (`int`), the maximum number of items to split into (equivalent to `-split \".\",2`)\r\n\r\n# Concluding\r\n\r\nI believe these commands to improve the interactive console experience of most users, without having significant drawbacks and am perfectly willing to do the implementation myself, pending the approval of the court of public opinion :)\r\n\r\nOpinions / comments / refinements, anybody?\r\n\r\n`2018-04-27` - Updated parameter names, replaced `Remove-String (trim)`  with `Get-SubString`","author":{"url":"https://github.com/FriedrichWeinmann","@type":"Person","name":"FriedrichWeinmann"},"datePublished":"2018-04-21T21:51:49.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":20},"url":"https://github.com/6697/PowerShell/issues/6697"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:1bab10e7-c443-4a83-f706-9c9feea8215f
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idC664:103DBC:2739C3D:34AC555:6A59B334
html-safe-nonce1bc547fdf7b852671dd1799b4d61586bcf0326fe82b332039b5f7615cbb12062
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNjY0OjEwM0RCQzoyNzM5QzNEOjM0QUM1NTU6NkE1OUIzMzQiLCJ2aXNpdG9yX2lkIjoiNDU5ODYyMzI1MDg0MzAyMjEzMiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacbdf73a543cec545c218c3a792b823a3a96436278203ceadf133e74547fd8479a
hovercard-subject-tagissue:316528424
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PowerShell/6697/issue_layout
twitter:imagehttps://opengraph.githubassets.com/f556671c8d4ad58e8b9e4a1278e0287b912b0f88593178aed12750a2ffcb9882/PowerShell/PowerShell/issues/6697
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/f556671c8d4ad58e8b9e4a1278e0287b912b0f88593178aed12750a2ffcb9882/PowerShell/PowerShell/issues/6697
og:image:altIntroduction One of the things I have seen that always bugged me in PowerShell was the fact, that string operators cannot be used on a pipeline. A simple example: (2,3,1,4 | Sort-Object) -join "." ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameFriedrichWeinmann
hostnamegithub.com
expected-hostnamegithub.com
Noneba3976babb66479b1c943a8edc0777d96157da48fadc0161f9ddb219deee8353
turbo-cache-controlno-preview
go-importgithub.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git
octolytics-dimension-user_id11524380
octolytics-dimension-user_loginPowerShell
octolytics-dimension-repository_id49609581
octolytics-dimension-repository_nwoPowerShell/PowerShell
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id49609581
octolytics-dimension-repository_network_root_nwoPowerShell/PowerShell
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releaseab680789ae4a316cdaf0d5a292a1760140931cc4
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/PowerShell/PowerShell/issues/6697#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FPowerShell%2FPowerShell%2Fissues%2F6697
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FPowerShell%2FPowerShell%2Fissues%2F6697
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=PowerShell%2FPowerShell
Reloadhttps://github.com/PowerShell/PowerShell/issues/6697
Reloadhttps://github.com/PowerShell/PowerShell/issues/6697
Reloadhttps://github.com/PowerShell/PowerShell/issues/6697
Please reload this pagehttps://github.com/PowerShell/PowerShell/issues/6697
PowerShell https://github.com/PowerShell
PowerShellhttps://github.com/PowerShell/PowerShell
Notifications https://github.com/login?return_to=%2FPowerShell%2FPowerShell
Fork 8.4k https://github.com/login?return_to=%2FPowerShell%2FPowerShell
Star 54.4k https://github.com/login?return_to=%2FPowerShell%2FPowerShell
Code https://github.com/PowerShell/PowerShell
Issues 1.2k https://github.com/PowerShell/PowerShell/issues
Pull requests 290 https://github.com/PowerShell/PowerShell/pulls
Discussions https://github.com/PowerShell/PowerShell/discussions
Actions https://github.com/PowerShell/PowerShell/actions
Projects https://github.com/PowerShell/PowerShell/projects
Security and quality 3 https://github.com/PowerShell/PowerShell/security
Insights https://github.com/PowerShell/PowerShell/pulse
Code https://github.com/PowerShell/PowerShell
Issues https://github.com/PowerShell/PowerShell/issues
Pull requests https://github.com/PowerShell/PowerShell/pulls
Discussions https://github.com/PowerShell/PowerShell/discussions
Actions https://github.com/PowerShell/PowerShell/actions
Projects https://github.com/PowerShell/PowerShell/projects
Security and quality https://github.com/PowerShell/PowerShell/security
Insights https://github.com/PowerShell/PowerShell/pulse
New Feature: Commands for string methods & operators on the pipelinehttps://github.com/PowerShell/PowerShell/issues/6697#top
Issue-Enhancementthe issue is more of a feature request than a bughttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Issue-Enhancement%22
Resolution-No ActivityIssue has had no activity for 6 months or morehttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Resolution-No%20Activity%22
WG-Cmdlets-Utilitycmdlets in the Microsoft.PowerShell.Utility modulehttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22WG-Cmdlets-Utility%22
https://github.com/FriedrichWeinmann
FriedrichWeinmannhttps://github.com/FriedrichWeinmann
on Apr 21, 2018https://github.com/PowerShell/PowerShell/issues/6697#issue-316528424
Issue-Enhancementthe issue is more of a feature request than a bughttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Issue-Enhancement%22
Resolution-No ActivityIssue has had no activity for 6 months or morehttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Resolution-No%20Activity%22
WG-Cmdlets-Utilitycmdlets in the Microsoft.PowerShell.Utility modulehttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22WG-Cmdlets-Utility%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.