当前位置:网站首页>JS obtient la chaîne spécifiée spécifiant la position du caractère & sous - chaîne spécifiant la plage de position du caractère 【 détails simples 】
JS obtient la chaîne spécifiée spécifiant la position du caractère & sous - chaîne spécifiant la plage de position du caractère 【 détails simples 】
2022-06-30 10:06:00 【Poyun V】
JsObtient la chaîne spécifiée spécifie la position du caractère&Sous - chaîne spécifiant l'intervalle de position du caractère
1.Obtient la position du caractère spécifié
--Exemple de chaîne
var currentJsonRow.TRADE_TYPE='[1001]Cautions';
Syntaxe:
String.substring("Spécifier les caractères")
---Exemple
currentJsonRow.TRADE_TYPE.substring("[")
Résultats: '[1001]Cautions'
2.Obtient un sous - ensemble de l'intervalle de caractères spécifié
Première catégorie:PréventionIEUtilisation incompatible(Il y a des usines où j'ai vraiment vomi~!J'aime ça.IE…Le paupière droit a encore sauté>…<)
Comme obtenir la première fois[]Sous - chaîne entre parenthèses
Regardez le code ci - dessous!(C'est très intuitif.!!)
currentJsonRow.TRADE_TYPE.substring(currentJsonRow.TRADE_TYPE.indexOf("[")+1,currentJsonRow.TRADE_TYPE.indexOf("]"))
Résultats: '1001'
Deuxième type:Expression régulière(YYDS!_Volontiers.)
Syntaxe:
/(?<=\[)(.+?)(?=\])/g
//Obtenir les données entre parenthèses
TRADE_TYPE_NUM = currentJsonRow.TRADE_TYPE.match(/(?<=\[)(.+?)(?=\])/g)[0];
[ Voici votre propre code d'entreprise ,Pas besoin de regarder_^^]
//Ajouter un jugement-- Augmentation des conditions sélectionnées
if ($("[id$=hidShopID]").val() == "G181") {
if (currentJsonRow.TRADE_TYPE.match(/(?<=\[)(.+?)(?=\])/g) != null || currentJsonRow.TRADE_TYPE.match(/(?<=\[)(.+?)(?=\])/g) != undefined) {
TRADE_TYPE_NUM = currentJsonRow.TRADE_TYPE.match(/(?<=\[)(.+?)(?=\])/g)[0];
} else {
TRADE_TYPE_NUM = currentJsonRow.TRADE_TYPE.split('|')[0];
}
if (TRADE_TYPE_NUM == "Tous" || TRADE_TYPE_NUM == null || TRADE_TYPE_NUM == undefined) {
xAlert(">>^=^<<");
return;
}
}
边栏推荐
- The present situation and challenge of the infrastructure of Yiwen parsing database
- Cloud native database
- Based on svelte3 X desktop UI component library svelte UI
- Is the jar package for the project or the project for the jar package
- Eight sorts (I)
- 11. customize hooks
- 安装和使用
- GPT (improving language understanding generative pre training) paper notes
- 2021-07-26
- MIT-6874-Deep Learning in the Life Sciences Week6
猜你喜欢
Train an image classifier demo in pytorch [learning notes]
Cobbler Automated Deployment
Machine learning note 9: prediction model optimization (to prevent under fitting and over fitting problems)
Add / delete query of topic
Shell script multi loop experiment
Flutter 中的 ValueNotifier 和 ValueListenableBuilder
9.缓存优化
GPT (improving language understanding generative pre training) paper notes
Flume learning II - Cases
Principle and implementation of small program hand-held bullet screen (uni APP)
随机推荐
Differences and relationships among hyper convergence, software defined storage (SDS), distributed storage and server San
11. customize hooks
Object detection yolov5 open source project debugging
Quick completion guide for mechanical arm (V): end effector
Datatabletomodellist entity class
7.手机登陆功能开发
[ubuntu-mysql 8 installation and master-slave replication]
ModuleNotFoundError: No module named ‘_swigfaiss‘
事件委托的使用与说明》
Thrift easy to use
Returnjson, which allows more custom data or class names to be returned
正则表达式基础
AttributeError: ‘Version‘ object has no attribute ‘major‘
Redis docker 主从模式与哨兵sentinel
2021-07-26
Small program development journey
The present situation and challenge of the infrastructure of Yiwen parsing database
Dart development skills
JWT expiration processing - single token scheme
一些国内镜像源