简体   繁体   English

从数据中提取特定文本

[英]extract specific text from data

I have below text and I want to extract Comment allez-vous from below text how do I extract using C# ?. 我有下面的文本,我想从下面的文本中提取Comment allez-vous,如何使用C#提取? This text will be different all the time. 此文本将始终不同。 rest of the data format is the same. 其余数据格式相同。

handleResponse({
 "data": {
  "translations": [
   {
    "translatedText": "Comment allez-vous"
   }
  ]
 }
}
);

It's JSON. 是JSON。 Use a JSON parser for .Net like JSON.NET or the JavaScriptSerializer 对.Net使用JSON解析器,例如JSON.NET或JavaScriptSerializer

  1. Look for last index of ". index A 查找“。索引A的最后一个索引”

  2. Find first index for translatedText + length of translatedText +1. 查找已翻译文本+已翻译文本长度+1的第一个索引。 index B 指数B

  3. fetch all string betwee B and A. 在B和A之间获取所有字符串。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM