当前位置:   article > 正文

sqlite3替换换行符号

sqlite3替换

需求:
将数据库中的markdown文本导出后换行符变成了“\n”,再导入到其他数据库时需要将\n转成数据库中的换行。
方法:
sqlite中 换行符 为x’0a’
Sqlite 字段替换换行符 方法为:update table set title =replace(title, x'0a','')

解释:
其实,在sqlite中特殊的字符是ASCLL码,如果想替换回车字符改成13,可以如下写法:

UPDATE table_name SET field_name=REPLACE(field_name,char(13),'')
UPDATE table_name SET field_name=REPLACE(field_name,x'13',‘')
  • 1
  • 2

最后,附上 ASCII码表 0-127

二进制DecodeHex 缩写/字符解释
000000000 00NUL(null) 空字符
000000011 01SOH(start of headling) 标题开始
000000102 02STX (start of text) 正文开始
000000113 03ETX (end of text) 正文结束
000001004 04EOT (end of transmission) 传输结束
000001015 05ENQ (enquiry) 请求
000001106 06ACK (acknowledge) 收到通知
000001117 07BEL (bell) 响铃
000010008 08BS (backspace) 退格
000010019 09HT (horizontal tab) 水平制表符
00001010100ALF (NL line feed, new line) 换行键
00001011110BVT (vertical tab) 垂直制表符
00001100120CFF (NP form feed, new page) 换页键
00001101130DCR (carriage return) 回车键
00001110140ESO (shift out) 不用切换
00001111150FSI (shift in) 启用切换
000100001610DLE (data link escape) 数据链路转义
000100011711DC1 (device control 1) 设备控制1
000100101812DC2 (device control 2) 设备控制2
000100111913DC3 (device control 3) 设备控制3
000101002014DC4 (device control 4) 设备控制4
000101012115NAK (negative acknowledge) 拒绝接收
000101102216SYN (synchronous idle) 同步空闲
000101112317ETB (end of trans. block) 传输块结束
000110002418CAN (cancel) 取消
000110012519EM (end of medium) 介质中断
00011010261ASUB (substitute) 替补
00011011271BESC (escape) 溢出
00011100281CFS (file separator) 文件分割符
00011101291DGS (group separator) 分组符
00011110301ERS (record separator) 记录分离符
00011111311FUS (unit separator) 单元分隔符
001000003220(space) 空格
001000013321!
001000103422"
001000113523#
001001003624$
001001013725%
001001103826&
001001113927
001010004028(
001010014129)
00101010422A*
00101011432B+
00101100442C,
00101101452D-
00101110462E.
00101111472F/
0011000048300
0011000149311
0011001050322
0011001151333
0011010052344
0011010153355
0011011054366
0011011155377
0011100056388
0011100157399
00111010583A:
00111011593B;
00111100603C<
00111101613D=
00111110623E>
00111111633F?
010000006440@
010000016541A
010000106642B
010000116743C
010001006844D
010001016945E
010001107046F
010001117147G
010010007248H
010010017349I
01001010744AJ
01001011754BK
01001100764CL
01001101774DM
01001110784EN
01001111794FO
010100008050P
010100018151Q
010100108252R
010100118353S
010101008454T
010101018555U
010101108656V
010101118757W
010110008858X
010110018959Y
01011010905AZ
01011011915B[
01011100925C\
01011101935D]
01011110945E^
01011111955F_
011000009660`
011000019761a
011000109862b
011000119963c
0110010010064 d
0110010110165 e
0110011010266 f
0110011110367 g
0110100010468 h
0110100110569 i
011010101066A j
011010111076B k
011011001086C l
011011011096D m
011011101106E n
011011111116F o
0111000011270 p
0111000111371 q
0111001011472 r
0111001111573 s
0111010011674 t
0111010111775 u
0111011011876 v
0111011111977 w
0111100012078 x
0111100112179 y
011110101227A z
011110111237B {
011111001247C
011111011257D }
011111101267E ~
011111111277F DEL (delete) 删除
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/AllinToyou/article/detail/173910
推荐阅读
相关标签
  

闽ICP备14008679号