SMS string split

xiaoxiao2021-03-05  26

Original post:

Http://community.9cbs.net/expert/topic/3927/3927305.xml?temp=.5815851

/*--Problem Description

According to the custom information prefix table (each information prefix can be seen as a information separator), the string split processing is made, in the split processing function, first define a message front table @splits, the table contains The AC, BC, CC, DC four information prefix (actually used, can add other information leading edges in the function, or define a formal table to save the information prefix data, so you can implement the user-defined information prefix data. deal with). Its spin-off handling process is like this:

(1) In the SMS string, each message is started with the specified information prefix, which is tightly contained in the prefix, so first get the SMS string, the first information prerupted string and its length, If the SMS string does not begin with an information prefix, it means not a correct SMS string, and the empty result set is returned directly.

(2) Get the first information prefix position after the first information prefix.

(3) If the information prefix does not exist, it is indicated that the last period of information is inserted into the result set and exits the function.

(4) If the information prefix exists, the current information segment is intercepted by this position, and the intercepted information segment is saved to the result set, then remove the splitted information segment from the SMS string, and the loop starts processing from (1). All information is divided until all the information is split.

- * /

If EXISTS (Select * from dbo.sysObjects where id = Object_id (n '[dbo]. [f_splitstr]') and xtype in (n'fn ', n'if', n't ') DROP FUNCTION [DBO] [f_splitstr] Go

/ * - String partial function

Split the string of the specified separator according to the custom separator list, return the result table

- Zou Jian 2005.04 (Please keep this information) - * /

/ * - Call example

转载请注明原文地址:https://www.9cbs.com/read-34806.html

New Post(0)