您现在的位置是:网站首页> 编程资料编程资料
Powershell截取字符串并添加省略号的例子_PowerShell_
2023-05-26
375人已围观
简介 Powershell截取字符串并添加省略号的例子_PowerShell_
限制字符串大小
支持所有版本。
确保你输出的字符串不会过长,当字符串超过你指定的长度你可以用下面办法将其缩短。
复制代码 代码如下:
if ($text.Length -gt $MaxLength)
{
$text.Substring(0,$MaxLength) + '...'
}
else
{
$text
}
您可能感兴趣的文章:
相关内容
- Powershell使用C#实现缩写路径_PowerShell_
- PowerShell中iso8601格式日期和DateTime对象互转实例_PowerShell_
- Powershell中显示隐藏文件的方法_PowerShell_
- PowerShell操作Excel、CSV详细介绍_PowerShell_
- Python中调用PowerShell、远程执行bat文件实例_PowerShell_
- PowerShell实现在多个文件中检索关键字功能_PowerShell_
- PowerShell脚本实现检测网络内主机类型_PowerShell_
- 在cmd中直接运行PowerShell脚本文件的方法_PowerShell_
- PowerShell查看进程的所属用户_PowerShell_
- Powershell实现捕获系统内置EXE程序的异常_PowerShell_
