当前位置:网站首页>Small example of regular expression--remove spaces in the middle and on both sides of the string
Small example of regular expression--remove spaces in the middle and on both sides of the string
2022-08-05 06:13:00 【CrazyQiQi】
Remove all spaces from a string using a regular expression
var str = " gs gdjkf gs gfsd ";str = str.trim(); //trim()Only spaces on both sides of the string can be removedvar getNewStr = function(str) { //Remove blanks in the string through regular expressionsvar reg = /^\s+|\s+|\s+$/g; //matches all whitespace at the beginning, end and in betweenstr = str.replace(reg, '')span>; //Replace all matching spaces with ''return str;}getNewStr(str); //What you get at this time is a string without spaces//gsgdjkfgsgfsd边栏推荐
- The spark operator - coalesce operator
- spark算子-textFile算子
- Getting Started Documentation 12 webserve + Hot Updates
- 入门文档11 自动添加版本号
- js动态获取屏幕宽高度
- Spark source code - task submission process - 6-sparkContext initialization
- 传输层协议(TCP3次握手)
- 7步完成云上监控
- 通过单总线调用ds18b20的问题
- The problem of calling ds18b20 through a single bus
猜你喜欢
随机推荐
Getting Started Doc 06 Adding files to a stream
入门文档03 区分开发与生产环境(生产环境才执行‘热更新’)
PVE 直通硬盘到TrueNAS
Getting Started 11 Automatically add version numbers
【Day1】VMware软件安装
spark source code - task submission process - 5-CoarseGrainedExecutorBackend
入门文档08 条件插件
Account and Permission Management
【Day1】(超详细步骤)构建软RAID磁盘阵列
CIPU,对云计算产业有什么影响
dsf5.0 弹框点确定没有返回值的问题
LinkSLA坚持用户第一,打造可持续的运维服务方案
Spark source code-task submission process-6.1-sparkContext initialization-create spark driver side execution environment SparkEnv
Configuration of TensorFlow ObjecDetectionAPI under Anaconda3 of win10 system
Getting Started Document 09 Standalone watch
spark operator-textFile operator
Getting Started 03 Distinguish between development and production environments ("hot update" is performed only in the production environment)
Why can't I add a new hard disk to scan?How to solve?
IP数据包格式(ICMP协议与ARP协议)
【Day8】(超详细步骤)使用LVM扩容








