当前位置:网站首页>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边栏推荐
- Getting Started Documentation 12 webserve + Hot Updates
- spark源码-任务提交流程之-3-ApplicationMaster
- 【Day8】Knowledge about disk and disk partition
- D45_摄像机组件Camera
- [Pytorch study notes] 8. How to use WeightedRandomSampler (weight sampler) when the training category is unbalanced data
- Unity3D中的ref、out、Params三种参数的使用
- 正则表达式小示例--获取重复最多的字符及其数量
- Image compression failure problem
- 不吹不黑,这的确是我看过微服务架构最好的文章!
- Getting Started Documentation 10 Resource Mapping
猜你喜欢
随机推荐
OpenCV3.0 is compatible with VS2010 and VS2013
7步完成云上监控
The spark operator - coalesce operator
I/O性能与可靠性
入门文档01 series按顺序执行
Spark source code-task submission process-6.2-sparkContext initialization-TaskScheduler task scheduler
TensorFlow ObjecDetectionAPI在win10系统Anaconda3下的配置
正则表达式小实例--去掉字符串中间和两边的空格
ROS video tutorial
【Machine Learning】1 Univariate Linear Regression
技术分享杂七杂八技术
入门文档05-2 使用return指示当前任务已完成
硬盘分区和永久挂载
运维的高光时刻,从智能化开始
markdown编辑器模板
Call the TensorFlow Objection Detection API for object detection and save the detection results locally
D39_坐标转换
海外服务器的优势
时间复杂度和空间复杂度
spark算子-wholeTextFiles算子




![[Pytorch study notes] 8. How to use WeightedRandomSampler (weight sampler) when the training category is unbalanced data](/img/29/5b44c016bd11f0c0a9110cf513f4e1.png)




