问题描述
我想查找字符串中特定字符的第一次和最后一次出现.例如,考虑一个名为"2010-####-3434"的字符串,并假设要搜索的字符为#".字符串中哈希的第一个出现在第6个位置,最后一个出现在第9个位置.
I want to find the first and the last occurrences of a specific character inside a string. As an example, consider a string named "2010-####-3434", and suppose the character to be searched for is "#". The first occurrence of hash inside the string is at 6-th position, and the last occurrence is at 9-th position.
推荐答案
我不知道该怎么做,但是像regexp_matches
,regexp_replace
和regexp_split_to_array
这样的正则表达式函数可能是解决您的问题.
I do not know how to do that, but the regular expression functions like regexp_matches
, regexp_replace
, and regexp_split_to_array
may be an alternative route to solving your problem.
这篇关于如何在PostgreSQL的字符串中查找特定字符的第一次和最后一次出现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!