Swift:获取字符串中子字符串的起始索引

时间:2015-08-19 20:39:29

标签: string swift indexof

有没有办法在字符串中搜索子字符串开头的索引?

赞,"hello".indexOf("el")会返回1.谢谢

1 个答案:

答案 0 :(得分:0)

您可以使用 select coalesce(concat(ages.n, ' year'), 'More than 10 year') as custom_text, count(t.age) from (select 1 as n union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9 union all select 10 union all select null ) ages left join tabla t on (case when ages.n<11 then t.age = ages.n else t.age > 10 end) group by ages.n; 函数找到并返回给定范围内给定字符串第一次出现的范围,如下所示:

rangeOfString

我希望这对你有所帮助。

相关问题