如何将给定的ID切成最后的“ [英] How to cut the given id by last "

查看:71
本文介绍了如何将给定的ID切成最后的“的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在从数据库中获取ID,就像这样

url ="http://localhost/project/IT/affect/run_report.TXT,
run_report"ows_MetaInfo =" 1000;#; ows__ModerationStatus = 0"
ows__Level ="1" ows_ID ="1000" ows_ows



但我想获得这样的价值

url ="http://localhost/project/IT/affect/run_report.TXT,
run_report"ows_MetaInfo =" 1000;#; ows__ModerationStatus = 0"
ows__Level ="1" ows_ID ="1000


我必须采用last的值,以this
结尾

请粘贴示例代码以执行此操作

问候,
basha.

hi All,

i am getting the id from the database as like this

url="http://localhost/project/IT/affect/run_report.TXT,
run_report " ows_MetaInfo="1000;#"; ows__ModerationStatus=0"
ows__Level="1" ows_ID="1000" ows_ows



but i want to get the value like this

url="http://localhost/project/IT/affect/run_report.TXT,
run_report " ows_MetaInfo="1000;#"; ows__ModerationStatus=0"
ows__Level="1" ows_ID="1000


i have to take the value of last " ending with this


Plz paste sample code to do this

Regards,
basha.

推荐答案

使用 string.lastindexof [ ^ ]方法找到最后的双引号字符的位置,然后使用 string.substring [ ^ ]删除所有结尾的字符:
Use the string.lastindexof[^] method to find the position of the final double quote character, and then use string.substring[^] to remove all trailing characters:
string inp = "url=\"http://localhost/project/IT/affect/run_report.TXT, " +
             "run_report \" ows_MetaInfo=\"1000;#\"; ows__ModerationStatus=0\"" +
             "ows__Level=\"1\" ows_ID=\"1000\" ows_ows";
int finalDQ = inp.LastIndexOf('"');
inp = inp.Substring(0, finalDQ);


这篇关于如何将给定的ID切成最后的“的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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