【问题标题】:Postgresql function similar to Find() in Excel?类似于 Excel 中的 Find() 的 Postgresql 函数?
【发布时间】:2016-12-14 15:46:50
【问题描述】:

如何在 Postgresql-9.3+ 中找到从指定索引开始的字符串的位置

例子

find('ranranran','an',1) should output 2
find('ranranran','an',3)  => 5 
find('ranranran','an',6)  => 8

【问题讨论】:

标签: postgresql postgresql-9.3


【解决方案1】:

我已经找到了答案,只是想发布它。

strpos(substr('withintext',pos),'texttofind') + (pos-1)

【讨论】:

    猜你喜欢
    • 2012-01-05
    • 1970-01-01
    • 1970-01-01
    • 2023-01-08
    • 2021-02-02
    • 1970-01-01
    • 1970-01-01
    • 2012-03-15
    • 1970-01-01
    相关资源
    最近更新 更多