关于子串的问题 [英] question on substring

查看:77
本文介绍了关于子串的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何摆脱或 (最后)来自这个字符串?


我有:"关键词LIKE''%''''或关键词LIKE''%huzz%''或

我想:"关键词LIKE''%awlad%''或关键词LIKE''%huzz%''"


非常感谢

How do i get rid of the "OR " (at the end) from this string?

I have : "Keywords LIKE ''%awlad%'' OR Keywords LIKE ''%huzz%'' OR "
I want: "Keywords LIKE ''%awlad%'' OR Keywords LIKE ''%huzz%'' "

Many thanks

推荐答案




" huzz"写道:


"huzz" wrote:
我如何摆脱或 (最后)来自这个字符串?

我有:关键词LIKE''%''''或关键词LIKE''%huzz%''或
我想要:关键词喜欢'%%'''或关键词LIKE''%huzz%''"

非常感谢
How do i get rid of the "OR " (at the end) from this string?

I have : "Keywords LIKE ''%awlad%'' OR Keywords LIKE ''%huzz%'' OR "
I want: "Keywords LIKE ''%awlad%'' OR Keywords LIKE ''%huzz%'' "

Many thanks



嗨huzz,


嗯,我不完全确定这是最好的方法,但如果你知道

就有或者 "最后你可以做什么


String s =" Keywords LIKE''%awlad%''OR Keywords LIKE''%huzz%''OR" ;;

s = s.Substring(0,s.Length - " OR" .Length);

-

快乐编码!

Morten Wennevik [C#MVP]
Hi huzz,

Well, I''m not entirely sure this is the best approach, but if you know
there is "OR " at the end you could do

String s = "Keywords LIKE ''%awlad%'' OR Keywords LIKE ''%huzz%'' OR ";
s = s.Substring(0, s.Length - "OR ".Length);
--
Happy Coding!
Morten Wennevik [C# MVP]


>我有:关键词LIKE''%''''或关键词LIKE''%huzz%''或
> I have : "Keywords LIKE ''%awlad%'' OR Keywords LIKE ''%huzz%'' OR "
我想要:" Keywords LIKE''%awlad%''或者关键词LIKE''%huzz%''"


string s =" Keywords LIKE''%awlad%''OR Keywords LIKE''%huzz%''OR" ;;


if(s.EndsWith(" OR))

{

//第一个参数是起始索引,第二个参数是字符数。

s = s.Substring(0,s.LastIndexOf(" OR"));

}


Debug.Print (s);


//应该打印:关键词LIKE''%awlad%''或关键词LIKE''%huzz%''"


-

Dave Sexton
dave @ www..jwaonline..com

--------------------------------------- --------------------------------

" huzz" <胡** @ discussions.microsoft.com>在留言新闻中写道:BD ********************************** @ microsof t.com ...怎么做我摆脱了OR (最后)来自这个字符串?

我有:关键词LIKE''%''''或关键词LIKE''%huzz%''或
我想要:关键词喜欢'%%'''或关键词LIKE''%huzz%''"

非常感谢
I want: "Keywords LIKE ''%awlad%'' OR Keywords LIKE ''%huzz%'' "
string s = "Keywords LIKE ''%awlad%'' OR Keywords LIKE ''%huzz%'' OR ";

if (s.EndsWith(" OR "))
{
// First argument is the start index, second argument is the number of characters.
s = s.Substring(0, s.LastIndexOf(" OR "));
}

Debug.Print(s);

// should print: "Keywords LIKE ''%awlad%'' OR Keywords LIKE ''%huzz%'' "

--
Dave Sexton
dave@www..jwaonline..com
-----------------------------------------------------------------------
"huzz" <hu**@discussions.microsoft.com> wrote in message news:BD**********************************@microsof t.com... How do i get rid of the "OR " (at the end) from this string?

I have : "Keywords LIKE ''%awlad%'' OR Keywords LIKE ''%huzz%'' OR "
I want: "Keywords LIKE ''%awlad%'' OR Keywords LIKE ''%huzz%'' "

Many thanks



这篇关于关于子串的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆