等效的INSTR转换成c# string.indexof()如何使用
本文关键字:indexof 何使用 string INSTR 转换 | 更新日期: 2023-09-27 18:11:29
我在oracle的一个函数中有if else条件我需要将其转换为c#代码,请帮助。
IF INSTR( pString, pSeparator, -1, 1) != ( LENGTH( RTRIM( pString )) - LENGTH( pSeparator ) + 1 )
THEN
-- There isn't one at the end so add it
l_Return := pString || pSeparator;
--DBMS_OUTPUT.PUT_LINE('Did not find seperator - ADDING');
在这种情况下,您可以使用string.EndsWith()
代替,这正是您要检查的:
if(!pString.EndsWith(pSeparator))
{
//There isn't one at the end so add it
}