当前位置: 首页 > news >正文

SQL server 同环比计算模板

1、计算 月 年 季度的环比和同比 

计算公式如下:

环比增长率 = (本期数 - 上期数) / |上期数| × 100%
同比增长率 = (本期数 - 同期数) / |同期数| * 100%

--- dbo.ads_erp_finance_gross_profit_actual_invoice_yoy_mom_month-- Insert statements for procedure hereDELETE FROM dbo.ads_erp_finance_gross_profit_actual_invoice_yoy_mom_month WHERE dt = @DateThresholdBEGIN TRY  DECLARE @Sql44 NVARCHAR(MAX) =  N'WITH month_sales AS ( select dt,year,CAST(SUBSTRING(ym, 6, 2) AS INT) AS month, money as month_money from dws_erp_finance_gross_profit_actual_invoice_month where dt = ' + QUOTENAME(CONVERT(NVARCHAR(10), @DateThreshold, 120), '''') + N'), sales AS (  SELECT t3.year,t3.month,t3.month_money AS month_money,t3.same_month_last_year_money,ROW_NUMBER() OVER (PARTITION BY [year], [month] ORDER BY [month_money]) AS rn FROM  (SELECT t1.year,t2.year as last_year,t1.month,t1.month_money,t2.month_money AS same_month_last_year_money FROM month_sales AS t1 LEFT JOIN month_sales AS t2 ON t1.month = t2.month AND t1.year - 1 = t2.year) t3), months AS ( SELECT DISTINCT [year], month FROM sales )  INSERT INTO dbo.ads_erp_finance_gross_profit_actual_invoice_yoy_mom_month ([dt],[ym],[month_money],[previous_month_money],[same_month_last_year_money],[yoy_growth_rate],[mom_growth_rate])select ' + QUOTENAME(CONVERT(NVARCHAR(10), @DateThreshold, 120), '''') + N' as dt, CAST(year AS VARCHAR)+ ''-''+  RIGHT(''0'' + CAST(month AS VARCHAR), 2) AS ym,month_money,previous_month_money,same_month_last_year_money,CASE WHEN same_month_last_year_money = 0 THEN null ELSE ((month_money - same_month_last_year_money) / ABS(same_month_last_year_money)) * 100 END AS yoy_growth_rate,CASE WHEN previous_month_money = 0 THEN null ELSE ((month_money - previous_month_money) / ABS(previous_month_money)) * 100 END AS mom_growth_ratefrom ( SELECT DISTINCT q.[year],q.[month],case when s.[month_money] is NULL then 0 else s.[month_money] end AS month_money,    case when sqs.[month_money] is NULL then 0 else sqs.[month_money] end AS same_month_last_year_money,t4.previous_month_money FROM months q  JOIN sales s ON q.[year] = s.[year] AND q.[month] = s.[month] AND s.rn = 1  LEFT JOIN sales sqs ON q.[year] - 1 = sqs.[year] AND q.[month] = sqs.[month] AND sqs.rn = 1left join ( select t2.dt,ym,t2.year,t2.month,t2.month_money,case when monthdiff = 1 then previous_month_money else 0 end  previous_month_moneyfrom(select dt,ym,SUBSTRING(ym, 1, 4) AS year,CAST(SUBSTRING(ym, 6, 2) AS INT) AS month,previous_month,month_money,previous_month_money,DATEDIFF(MONTH, CAST(CAST(previous_month AS VARCHAR) + ''-01'' AS DATE) , CAST(CAST(ym AS VARCHAR) + ''-01'' AS DATE)) monthdifffrom(SELECT t1.dt,t1.year,t1.quarter, t1.ym, CASE WHEN t1_prev.ym IS NULL THEN ''1970-01'' ELSE t1_prev.ym END AS previous_month,CASE WHEN t1_prev.money IS NULL THEN 0 ELSE t1_prev.money END AS previous_month_money,t1.money AS month_money FROM dws_erp_finance_gross_profit_actual_invoice_month t1LEFT JOIN dws_erp_finance_gross_profit_actual_invoice_month t1_prev ON t1.dt = t1_prev.dt AND t1.ym > t1_prev.ymWHERE t1.dt = ' + QUOTENAME(CONVERT(NVARCHAR(10), @DateThreshold, 120), '''') + N' AND NOT EXISTS ( SELECT 1 FROM dws_erp_finance_gross_profit_actual_invoice_month t2 WHERE t2.dt = t1.dt AND t2.ym > t1_prev.ym AND t2.ym < t1.ym )) t1) t2 ) t4 on q.year = t4.year and q.month = t4.month) t1'SET @Sql44 = REPLACE(@Sql44, '@DateThreshold', @DateThreshold)print(@Sql44)EXEC sp_executesql @Sql44END TRY  BEGIN CATCH  DECLARE @ErrorMessage44 NVARCHAR(4000)  SET @ErrorMessage44 = ERROR_MESSAGE()  RAISERROR (@ErrorMessage44, 16, 1)  END CATCH--- dbo.ads_erp_finance_gross_profit_actual_invoice_yoy_pop_quarter-- Insert statements for procedure hereDELETE FROM dbo.ads_erp_finance_gross_profit_actual_invoice_yoy_pop_quarter WHERE dt = @DateThresholdBEGIN TRY  DECLARE @Sql45 NVARCHAR(MAX) =  N'WITH year_quarter_sales AS (SELECT [year] + '' Q''+ [quarter] AS year_quarter,SUM(money) AS quarter_moneyFROM dws_erp_finance_gross_profit_actual_invoice_month WHERE dt = ' + QUOTENAME(CONVERT(NVARCHAR(10), @DateThreshold, 120), '''') + N' GROUP BY [year] + '' Q''+ [quarter]),quarter_sales AS (SELECT [year],[quarter],sum(money) as quarter_money FROM dws_erp_finance_gross_profit_actual_invoice_month where dt = ' + QUOTENAME(CONVERT(NVARCHAR(10), @DateThreshold, 120), '''') + N' group by year, quarter),sales AS ( SELECT  t3.year, t3.quarter,t3.quarter_money AS [quarter_money], t3.same_quarter_last_year_money, ROW_NUMBER() OVER (PARTITION BY [year], [quarter] ORDER BY [quarter_money]) AS rn  FROM  (SELECT t1.year,t2.year as last_year,t1.quarter,t1.quarter_money,t2.quarter_money AS same_quarter_last_year_money FROM quarter_sales as t1 LEFT JOIN quarter_sales as t2 ON t1.quarter = t2.quarter AND t1.year - 1 = t2.year) t3), quarters AS ( SELECT DISTINCT [year], [quarter] FROM sales )INSERT INTO dbo.ads_erp_finance_gross_profit_actual_invoice_yoy_pop_quarter ([dt],[year],[quarter],[quarter_money],[previous_quarter_money],[same_quarter_last_year_money],[yoy_growth_rate],[qoq_growth_rate])select ' + QUOTENAME(CONVERT(NVARCHAR(10), @DateThreshold, 120), '''') + N' as dt,year,quarter,quarter_money,previous_quarter_money,same_quarter_last_year_money,CASE WHEN same_quarter_last_year_money = 0 THEN null ELSE ((quarter_money - same_quarter_last_year_money) / ABS(same_quarter_last_year_money)) * 100 END AS yoy_growth_rate,CASE WHEN previous_quarter_money = 0 THEN null ELSE ((quarter_money - previous_quarter_money) / ABS(previous_quarter_money)) * 100 END AS qoq_growth_ratefrom ( SELECT DISTINCT q.[year],q.[quarter],case when s.[quarter_money] is NULL then 0 else s.[quarter_money] end AS quarter_money,   case when pqs.[previous_quarter_money] is NULL then 0 else pqs.[previous_quarter_money] end AS previous_quarter_money,   case when sqs.[quarter_money] is NULL then 0 else sqs.[quarter_money] end AS same_quarter_last_year_money FROM quarters q  JOIN sales s ON q.[year] = s.[year] AND q.[quarter] = s.[quarter] AND s.rn = 1   LEFT JOIN sales sqs ON q.[year] - 1 = sqs.[year] AND q.[quarter] = sqs.[quarter] AND sqs.rn = 1LEFT JOIN (select t3.dt,t3.year,SUBSTRING(t3.year_quarter, 7, 1) AS quarter,previous_quarter,quarter_money,previous_quarter_moneyfrom (SELECT ' + QUOTENAME(CONVERT(NVARCHAR(10), @DateThreshold, 120), '''') + N' as dt,SUBSTRING(t1.year_quarter, 1, 4) AS year,t1.year_quarter,CASE WHEN t1_prev.year_quarter IS NULL THEN ''1970 Q1'' ELSE t1_prev.year_quarter END AS previous_quarter,t1.quarter_money AS quarter_money,CASE WHEN t1_prev.quarter_money IS NULL THEN 0 ELSE t1_prev.quarter_money END AS previous_quarter_money FROM year_quarter_sales as t1LEFT JOIN year_quarter_sales as t1_prev ON t1.year_quarter > t1_prev.year_quarterWHERE  NOT EXISTS (SELECT 1 FROM year_quarter_sales as t2 WHERE t2.year_quarter > t1_prev.year_quarter AND t2.year_quarter < t1.year_quarter)) t3 ) pqs ON q.[year] = pqs.[year] AND q.[quarter] = pqs.[quarter] ) t1 order by year, quarter asc' SET @Sql45 = REPLACE(@Sql45, '@DateThreshold', @DateThreshold)print(@Sql45)EXEC sp_executesql @Sql45END TRY  BEGIN CATCH  DECLARE @ErrorMessage45 NVARCHAR(4000)  SET @ErrorMessage45 = ERROR_MESSAGE()  RAISERROR (@ErrorMessage45, 16, 1)  END CATCH--- dbo.ads_erp_finance_gross_profit_actual_invoice_yoy_year-- Insert statements for procedure hereBEGIN TRY  DELETE FROM dbo.ads_erp_finance_gross_profit_actual_invoice_yoy_year WHERE dt = @DateThresholdDECLARE @Sql46 NVARCHAR(MAX) =  N'WITH year_sales AS (select year,sum(money) as year_money from dws_erp_finance_gross_profit_actual_invoice_month where dt =' + QUOTENAME(CONVERT(NVARCHAR(10), @DateThreshold, 120), '''') + N' group by year)INSERT INTO dbo.ads_erp_finance_gross_profit_actual_invoice_yoy_year ([dt],[year],[year_money],[previous_year_money],[yoy_growth_rate])select dt,year,year_money,previous_year_money,CASE WHEN previous_year_money = 0 THEN null ELSE ((year_money - previous_year_money) / ABS(previous_year_money)) * 100 END AS yoy_growth_ratefrom (SELECT ' + QUOTENAME(CONVERT(NVARCHAR(10), @DateThreshold, 120), '''') + N' as dt,t1.year,CASE WHEN t1_prev.year IS NULL THEN ''1970'' ELSE t1_prev.year END AS previous_year,t1.year_money AS year_money,CASE WHEN t1_prev.year_money IS NULL THEN 0 ELSE t1_prev.year_money END AS previous_year_money FROM  year_sales as t1LEFT JOIN year_sales as t1_prev ON t1.year > t1_prev.yearWHERE  NOT EXISTS ( SELECT 1 FROM year_sales as t2 WHERE t2.year > t1_prev.year AND t2.year < t1.year)) t2'SET @Sql46 = REPLACE(@Sql46, '@DateThreshold', @DateThreshold)print(@Sql46)EXEC sp_executesql @Sql46	END TRY  BEGIN CATCH  DECLARE @ErrorMessage46 NVARCHAR(4000)  SET @ErrorMessage46 = ERROR_MESSAGE()  RAISERROR (@ErrorMessage46, 16, 1)  END CATCH

2、基础月表:

--- dbo.dws_erp_finance_gross_profit_actual_invoice_month-- Insert statements for procedure hereBEGIN TRY  DELETE FROM dbo.dws_erp_finance_gross_profit_actual_invoice_month WHERE dt = @DateThreshold  INSERT INTO dbo.dws_erp_finance_gross_profit_actual_invoice_month ([dt],[year],[quarter],[ym],actual_invoice_money,sale_cost_money, money)select @DateThreshold as dt, [year],[quarter],[ym], actual_invoice_money,sale_cost_money,actual_invoice_money - sale_cost_money  as moneyfrom (select t1.year,t1.quarter,t1.ym,case when t2.actual_invoice_money is NULL then 0 else t2.actual_invoice_money end as actual_invoice_money,case when t3.sale_cost_money is NULL then 0 else t3.sale_cost_money end as sale_cost_moneyfrom (select dt,year,quarter,ymfrom dim_year_quarter_month where dt = @DateThreshold) t1left join (select year,quarter,ym, money as actual_invoice_money from dws_erp_finance_paybackinvoicesure_month where dt = @DateThreshold) t2on t1.ym = t2.ymleft join (select year,quarter,ym,money as sale_cost_money from dws_erp_finance_cost_month where dt = @DateThreshold) t3on t1.ym = t3.ym) t5DELETE FROM dbo.dws_erp_finance_gross_profit_actual_invoice_month WHERE dt = DATEADD(day, -7, @DateThreshold)print('dws_erp_finance_gross_profit_actual_invoice_month')END TRY  BEGIN CATCH  DECLARE @ErrorMessage37 NVARCHAR(4000)  SET @ErrorMessage37 = ERROR_MESSAGE()  RAISERROR (@ErrorMessage37, 16, 1)  END CATCH 

相关文章:

SQL server 同环比计算模板

1、计算 月 年 季度的环比和同比 计算公式如下&#xff1a; 环比增长率 &#xff08;本期数 - 上期数&#xff09; / |上期数| 100% 同比增长率 &#xff08;本期数 - 同期数&#xff09; / |同期数| * 100% --- dbo.ads_erp_finance_gross_profit_actual_invoice_yoy_m…...

python发送外部请求

在Python中&#xff0c;服务器发送外部请求是一个常见的操作&#xff0c;尤其是在需要集成不同服务或API时。有多种库可以帮助你完成这项任务&#xff0c;但最流行和广泛使用的库之一是requests。以下是如何使用requests库在Python服务器中发送外部请求的基本步骤&#xff1a; …...

c++并发编程面试题

1. C中lock_guard和unique_lock的区别&#xff1f; 在C中&#xff0c;lock_guard和unique_lock都是用于管理互斥锁的类&#xff0c;它们提供了一种 RAII&#xff08;Resource Acquisition Is Initialization&#xff09;机制来确保锁在作用域结束时自动释放。尽管它们的目的相…...

K8S上安装LongHorn(分布式块存储) --use

要在 Kubernetes上安装 LongHorn&#xff0c;您可以按照以下步骤进行操作&#xff1a; 准备工作 参考 官网教程将LongHorn只部署在k8s-worker5节点上。https://github.com/longhorn/longhorn 安装要求 Each node in the Kubernetes cluster where Longhorn is installed must f…...

2024年前端技术发展趋势分析

2024年的前端技术发展趋势继续受到快速变化的技术环境和不断增长的用户期望的影响。以下是2024年前端技术发展的几个关键趋势&#xff1a; 1. Web 组件和自定义元素 Web 组件技术&#xff08;包括 Shadow DOM、HTML Templates 和 Custom Elements&#xff09;正在成为构建可重…...

spring boot 笔记大杂烩

一&#xff0c;springboot项目创建 springboot创建时idea会打开start.spring.io失败报错 可以手动打开这个页面&#xff0c;然后选择maven项目&#xff0c;然后修改group和name名然后添加依赖web&#xff0c;然后生成项目包&#xff0c;解压缩后用idea打开就能用了 运行后报错…...

如何在香港云服务器上优化网站性能?

在香港云服务器上优化网站性能可以通过以下几种方式进行&#xff0c;确保用户从全球各地访问时获得快速、稳定的体验&#xff1a; 1. 使用内容分发网络 (CDN) 优势&#xff1a;CDN可以将静态内容&#xff08;如图像、视频、CSS、JavaScript文件&#xff09;缓存到全球多个节点…...

STM32低功耗与备用备份区域

STM的备份备用区域其实就是两个区块&#xff1a;BKP和RTC。低功耗则其实是STM32四种模式中的三种耗能很低的模式。 目录 一&#xff1a;备用区域 1.BKP 2.RTC 二&#xff1a;低功耗模式 1.睡眠模式&#xff1a; 2.停机模式&#xff1a; 3.待机模式&#xff1a; 一&…...

武汉某汽配公司携手三品软件 共绘PLM项目新蓝图

近日&#xff0c;三品软件与武汉某汽配公司达成战略合作&#xff0c;双方将共同启动PLM项目&#xff0c;以助力该公司在汽车制造业的研发管理领域实现全面升级。 客户简介 该公司自2008年成立以来&#xff0c;一直专注于为汽车制造业提供自动化输送系统、车辆装配的合装技术和…...

uniapp多图上传uni.chooseImage上传照片uni.uploadFile,默认上传9张图

uniapp多图上传uni.chooseImage上传照片uni.uploadFile 代码示例&#xff1a; /**上传照片 多图*/getImage() {uni.chooseImage({count: 9, //默认9sizeType: [original, compressed], //可以指定是原图还是压缩图&#xff0c;默认二者都有sourceType: [album], //从相册选择/…...

MySQL——内置函数

时间函数 select * from msg where date_add(sendtime, interval 2 minute) > now(); 理解&#xff1a; ------------------------------|-----------|-------------|------------------ 初始时间 now() 初始时间2min 字符串 length函数返回字符串长度&#xff0c;以字节为…...

2024年最新版小程序云开发数据模型的开通步骤,支持可视化数据库管理,支持Mysql和NoSql数据库,可以在vue3前端web里调用操作

小程序官方又改版了&#xff0c;搞得石头哥不得不紧急的再新出一版&#xff0c;教大家开通最新版的数据模型。官方既然主推数据模型&#xff0c;那我们就先看看看新版的数据模型到底是什么。 一&#xff0c;什么是数据模型 数据模型是什么 数据模型是一个用于组织和管理数据的…...

智慧水库大坝安全监测预警系统解决方案

前言 水库大坝作为重要的水利设施&#xff0c;承载着防洪涝、灌溉、发电等功能&#xff0c;关系着无数人的生命财产安全&#xff0c;一旦发生意外事故&#xff0c;后果将不堪设想&#xff0c;因此需要建立一套水库大坝安全监测预警系统解决方案。 系统概述 水库大坝安全监测…...

基于SpringBoot+VUE的社区团购系统(源码+文档+部署)

主要内容&#xff1a;Java项目、Python项目、前端项目、PHP、ASP.NET、人工智能与大数据、单片机开发、物联网设计与开发设计、简历模板、学习资料、面试题库、技术互助、就业指导等 业务范围&#xff1a;免费功能设计、开题报告、任务书、中期检查PPT、系统功能实现、代码编写…...

LeetCode 3151. 特殊数组 I【数组】简单【Py3,C++,Java,GO,Rust】

本文属于「征服LeetCode」系列文章之一&#xff0c;这一系列正式开始于2021/08/12。由于LeetCode上部分题目有锁&#xff0c;本系列将至少持续到刷完所有无锁题之日为止&#xff1b;由于LeetCode还在不断地创建新题&#xff0c;本系列的终止日期可能是永远。在这一系列刷题文章…...

超级字符串技能:提升你的编码游戏

嘿嘿,uu们,今天咱们来详解字符函数与字符串函数,好啦,废话不多讲,开干&#xff01; 1.:字符分类函数 C语言中又一系列的函数是专门做字符分类的,也就是一个字符属于什么类型的字符的,这些函数的使用需要包含头文件ctype.h 这些函数的使用方法都十分类似,博主在这里就举两到三个…...

米联客-FPGA程序设计Verilog语法入门篇连载-16 Verilog语法_时钟分频设计

软件版本&#xff1a;无 操作系统&#xff1a;WIN10 64bit 硬件平台&#xff1a;适用所有系列FPGA 板卡获取平台&#xff1a;https://milianke.tmall.com/ 登录“米联客”FPGA社区 http://www.uisrc.com 视频课程、答疑解惑&#xff01; 1概述 本小节讲解Verilog语法的时钟…...

【Echarts】custom自定义图表实现甘特图

效果图 主要注意点&#xff1a; 1、右上角图例visualMap实现 2、visualMap增加formatter 3、series使用custom自定义图表&#xff0c;encode解析四维数组。核心是renderItem方法&#xff0c;必填项&#xff0c;且需要注意要全部定义在options里面&#xff01;&#xff01;&…...

【高等代数笔记】003线性方程组的解法(一)

1. 线性方程组的解法 1.1 解线性方程组的矩阵消元法 【例1】解线性方程组 { x 1 3 x 2 x 3 2 3 x 1 4 x 2 2 x 3 9 − x 1 − 5 x 2 4 x 3 10 2 x 1 7 x 2 x 3 1 \left\{\begin{array}{ll} x_{1}3x_{2}x_{3}2 \\ 3x_{1}4x_{2}2x_{3}9 \\ -x_{1}-5x_{2}4x_{3}10 \\…...

Scrapy入门教程

Scrapy入门教程&#xff1a;打造高效爬虫的第一步 1. 引言 在当今的网络世界中&#xff0c;信息是无价的资源。而爬虫工具则是获取这些资源的有力武器。Scrapy 是 Python 生态系统中最强大的爬虫框架之一&#xff0c;它不仅功能强大&#xff0c;而且易于扩展&#xff0c;适用…...

wordpress后台更新后 前端没变化的解决方法

使用siteground主机的wordpress网站&#xff0c;会出现更新了网站内容和修改了php模板文件、js文件、css文件、图片文件后&#xff0c;网站没有变化的情况。 不熟悉siteground主机的新手&#xff0c;遇到这个问题&#xff0c;就很抓狂&#xff0c;明明是哪都没操作错误&#x…...

《从零掌握MIPI CSI-2: 协议精解与FPGA摄像头开发实战》-- CSI-2 协议详细解析 (一)

CSI-2 协议详细解析 (一&#xff09; 1. CSI-2层定义&#xff08;CSI-2 Layer Definitions&#xff09; 分层结构 &#xff1a;CSI-2协议分为6层&#xff1a; 物理层&#xff08;PHY Layer&#xff09; &#xff1a; 定义电气特性、时钟机制和传输介质&#xff08;导线&#…...

2024年赣州旅游投资集团社会招聘笔试真

2024年赣州旅游投资集团社会招聘笔试真 题 ( 满 分 1 0 0 分 时 间 1 2 0 分 钟 ) 一、单选题(每题只有一个正确答案,答错、不答或多答均不得分) 1.纪要的特点不包括()。 A.概括重点 B.指导传达 C. 客观纪实 D.有言必录 【答案】: D 2.1864年,()预言了电磁波的存在,并指出…...

系统设计 --- MongoDB亿级数据查询优化策略

系统设计 --- MongoDB亿级数据查询分表策略 背景Solution --- 分表 背景 使用audit log实现Audi Trail功能 Audit Trail范围: 六个月数据量: 每秒5-7条audi log&#xff0c;共计7千万 – 1亿条数据需要实现全文检索按照时间倒序因为license问题&#xff0c;不能使用ELK只能使用…...

macOS多出来了:Google云端硬盘、YouTube、表格、幻灯片、Gmail、Google文档等应用

文章目录 问题现象问题原因解决办法 问题现象 macOS启动台&#xff08;Launchpad&#xff09;多出来了&#xff1a;Google云端硬盘、YouTube、表格、幻灯片、Gmail、Google文档等应用。 问题原因 很明显&#xff0c;都是Google家的办公全家桶。这些应用并不是通过独立安装的…...

微信小程序 - 手机震动

一、界面 <button type"primary" bindtap"shortVibrate">短震动</button> <button type"primary" bindtap"longVibrate">长震动</button> 二、js逻辑代码 注&#xff1a;文档 https://developers.weixin.qq…...

c#开发AI模型对话

AI模型 前面已经介绍了一般AI模型本地部署&#xff0c;直接调用现成的模型数据。这里主要讲述讲接口集成到我们自己的程序中使用方式。 微软提供了ML.NET来开发和使用AI模型&#xff0c;但是目前国内可能使用不多&#xff0c;至少实践例子很少看见。开发训练模型就不介绍了&am…...

【HTTP三个基础问题】

面试官您好&#xff01;HTTP是超文本传输协议&#xff0c;是互联网上客户端和服务器之间传输超文本数据&#xff08;比如文字、图片、音频、视频等&#xff09;的核心协议&#xff0c;当前互联网应用最广泛的版本是HTTP1.1&#xff0c;它基于经典的C/S模型&#xff0c;也就是客…...

Spring AI与Spring Modulith核心技术解析

Spring AI核心架构解析 Spring AI&#xff08;https://spring.io/projects/spring-ai&#xff09;作为Spring生态中的AI集成框架&#xff0c;其核心设计理念是通过模块化架构降低AI应用的开发复杂度。与Python生态中的LangChain/LlamaIndex等工具类似&#xff0c;但特别为多语…...

uniapp 字符包含的相关方法

在uniapp中&#xff0c;如果你想检查一个字符串是否包含另一个子字符串&#xff0c;你可以使用JavaScript中的includes()方法或者indexOf()方法。这两种方法都可以达到目的&#xff0c;但它们在处理方式和返回值上有所不同。 使用includes()方法 includes()方法用于判断一个字…...