blob: ab070ef7ed74e52e16206dc7694e1c9176f29b44 [file] [log] [blame]
"use strict";(self.webpackChunkdoris_website=self.webpackChunkdoris_website||[]).push([[64910],{15680:(e,n,t)=>{t.d(n,{xA:()=>u,yg:()=>y});var r=t(296540);function s(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function l(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?i(Object(t),!0).forEach((function(n){s(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):i(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function a(e,n){if(null==e)return{};var t,r,s=function(e,n){if(null==e)return{};var t,r,s={},i=Object.keys(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||(s[t]=e[t]);return s}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(s[t]=e[t])}return s}var o=r.createContext({}),c=function(e){var n=r.useContext(o),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},u=function(e){var n=c(e.components);return r.createElement(o.Provider,{value:n},e.children)},p="mdxType",f={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},d=r.forwardRef((function(e,n){var t=e.components,s=e.mdxType,i=e.originalType,o=e.parentName,u=a(e,["components","mdxType","originalType","parentName"]),p=c(t),d=s,y=p["".concat(o,".").concat(d)]||p[d]||f[d]||i;return t?r.createElement(y,l(l({ref:n},u),{},{components:t})):r.createElement(y,l({ref:n},u))}));function y(e,n){var t=arguments,s=n&&n.mdxType;if("string"==typeof e||s){var i=t.length,l=new Array(i);l[0]=d;var a={};for(var o in n)hasOwnProperty.call(n,o)&&(a[o]=n[o]);a.originalType=e,a[p]="string"==typeof e?e:s,l[1]=a;for(var c=2;c<i;c++)l[c]=t[c];return r.createElement.apply(null,l)}return r.createElement.apply(null,t)}d.displayName="MDXCreateElement"},938353:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>o,contentTitle:()=>l,default:()=>f,frontMatter:()=>i,metadata:()=>a,toc:()=>c});var r=t(58168),s=(t(296540),t(15680));const i={title:"SUB_REPLACE",language:"zh-CN"},l=void 0,a={unversionedId:"sql-manual/sql-functions/string-functions/sub-replace",id:"version-2.0/sql-manual/sql-functions/string-functions/sub-replace",title:"SUB_REPLACE",description:"\x3c!--",source:"@site/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.0/sql-manual/sql-functions/string-functions/sub-replace.md",sourceDirName:"sql-manual/sql-functions/string-functions",slug:"/sql-manual/sql-functions/string-functions/sub-replace",permalink:"/zh-CN/docs/2.0/sql-manual/sql-functions/string-functions/sub-replace",draft:!1,tags:[],version:"2.0",frontMatter:{title:"SUB_REPLACE",language:"zh-CN"},sidebar:"docs",previous:{title:"SUBSTRING",permalink:"/zh-CN/docs/2.0/sql-manual/sql-functions/string-functions/substring"},next:{title:"APPEND_TRAILING_CHAR_IF_ABSENT",permalink:"/zh-CN/docs/2.0/sql-manual/sql-functions/string-functions/append-trailing-char-if-absent"}},o={},c=[{value:"sub_replace",id:"sub_replace",level:2},{value:"description",id:"description",level:3},{value:"Syntax",id:"syntax",level:4},{value:"example",id:"example",level:3},{value:"keywords",id:"keywords",level:3}],u={toc:c},p="wrapper";function f(e){let{components:n,...t}=e;return(0,s.yg)(p,(0,r.A)({},u,t,{components:n,mdxType:"MDXLayout"}),(0,s.yg)("h2",{id:"sub_replace"},"sub_replace"),(0,s.yg)("h3",{id:"description"},"description"),(0,s.yg)("h4",{id:"syntax"},"Syntax"),(0,s.yg)("p",null,(0,s.yg)("inlineCode",{parentName:"p"},"VARCHAR sub_replace(VARCHAR str, VARCHAR new_str, INT start[, INT len])")),(0,s.yg)("p",null,"\u8fd4\u56de\u7528new_str\u5b57\u7b26\u4e32\u66ff\u6362str\u4e2d\u4ecestart\u5f00\u59cb\u957f\u5ea6\u4e3alen\u7684\u65b0\u5b57\u7b26\u4e32\u3002\n\u5176\u4e2dstart,len\u4e3a\u8d1f\u6574\u6570\uff0c\u8fd4\u56deNULL, \u4e14len\u7684\u9ed8\u8ba4\u503c\u4e3anew_str\u7684\u957f\u5ea6\u3002"),(0,s.yg)("h3",{id:"example"},"example"),(0,s.yg)("pre",null,(0,s.yg)("code",{parentName:"pre"},"mysql> select sub_replace(\"this is origin str\",\"NEW-STR\",1);\n+-------------------------------------------------+\n| sub_replace('this is origin str', 'NEW-STR', 1) |\n+-------------------------------------------------+\n| tNEW-STRorigin str |\n+-------------------------------------------------+\n\nmysql> select sub_replace(\"doris\",\"***\",1,2);\n+-----------------------------------+\n| sub_replace('doris', '***', 1, 2) |\n+-----------------------------------+\n| d***is |\n+-----------------------------------+\n")),(0,s.yg)("h3",{id:"keywords"},"keywords"),(0,s.yg)("pre",null,(0,s.yg)("code",{parentName:"pre"},"SUB_REPLACE\n")))}f.isMDXComponent=!0}}]);