当前位置:网站首页>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;
}
}
边栏推荐
- 事件委托的使用与说明》
- How can we have high performance and simple agility in the enterprise cloud on oracle?
- Techtarget: Interpretation of the basic concept of super fusion cloud
- Quick completion guide for manipulator (4): reducer of key components of manipulator
- C語言實現掃雷遊戲,附詳解及完整代碼
- Appium automation test foundation - ADB shell command
- Deberta (decoding enhanced Bert with distinguished attention)
- train_de.py: error: argument --save_steps: invalid int value: ‘$[$[889580/128/4]*10/2]‘
- keras ‘InputLayer‘ object is not iterable
- Flutter 中的 ValueNotifier 和 ValueListenableBuilder
猜你喜欢
云技能提升好伙伴,亚马逊云师兄今天正式营业
Quick completion guide for manipulator (4): reducer of key components of manipulator
【JVM】G1垃圾回收器简述
直播带货源码开发中,如何降低直播中的延迟?
CRF (conditional random field) learning summary
Enterprise data center "cloud" transformation solution
[new book recommendation] DeNO web development
机械臂速成小指南(四):机械臂关键部件之减速机
[new book recommendation] mongodb performance tuning
[JVM] brief introduction to CMS
随机推荐
Practice of super integration and transformation of core production business of public funds
How to build a private cloud and create a hybrid cloud ecosystem?
9.缓存优化
Appium automation test foundation - 12 Introduction to appium automated testing framework
Returnjson, which allows more custom data or class names to be returned
C语言实现扫雷游戏,附详解及完整代码
Flutter 中的 ValueNotifier 和 ValueListenableBuilder
MIT-6874-Deep Learning in the Life Sciences Week6
【AGC】构建服务3-认证服务示例
Add / delete query of topic
Brève description du collecteur d'ordures G1
Techtarget: Interpretation of the basic concept of super fusion cloud
关于字符串的split和join操作
Task summary in NLP
Forrester senior analyst: five important trends in the development of the hyper convergence market
Redis docker 主从模式与哨兵sentinel
Critical applications and hyper converged infrastructure: the time has come
G-Code 详解
Utlis memory pool object pool
Financial private cloud infrastructure scheme evaluation (Architecture and storage)