SQLite - 反向字符串函数 [英] SQLite - reverse string function

查看:59
本文介绍了SQLite - 反向字符串函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

SQLite 中是否有反转字符串的函数?我在文档中找不到任何内容.

Is there a function for reversing string in SQLite? I'm unable to find anything in the documentation.

谢谢!

推荐答案

没有内置函数.你可以添加自定义函数,就像在 Python 中的这个例子一样:

There is no builtin function for that. You can add custom function, like in this example in Python:

import sqlite3
conn = sqlite3.connect("")

conn.create_function("strrev", 1, lambda s: s[::-1])

cur = conn.cursor()
cur.execute(r''' SELECT strrev('hello, world') ''')
print(cur.fetchone()[0]) #dlrow ,olleh

这篇关于SQLite - 反向字符串函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆