gpt4 book ai didi

SQLite - 反向字符串函数

转载 作者:IT王子 更新时间:2023-10-29 06:23:25 26 4
gpt4 key购买 nike

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

最佳答案

没有内置函数。您可以添加自定义函数,如 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 - 反向字符串函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7826876/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com