将文本文件中的一部分放入文本框 [英] Get a part from textfile into textbox

查看:93
本文介绍了将文本文件中的一部分放入文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

另一个问题:

我的应用程序可以制作V卡.
我的应用程序的用户可以在Outlook中打开V卡.

我想在我的应用程序中打开V卡.
我听说这可能与Instr ??或类似的东西..从未听到过,所以这是我必须知道的:

Another question:

My application can make a V-Card.
The user of my app can open a V-Card in Outlook.

I want to open the V-Card in my app.
I have heard that this possible with a Instr ?? or something like that.. never heard from it so this is what I have to know:

BEGIN:VCard
VERSION:2.1
N:'T GROENE HART
FN:
TEL;WORK;VOICE:0505420369
TEL;WORK;VOICE:0505420369
TEL;HOME;VOICE:06-12345678
TEL;CELL;VOICE:06-12345678
TEL;VOICE:0512 342040
TEL;WORK;FAX:0512 342040
TEL;FAX:0512 342040
ADR;WORK;PREF:;;Straat 34;HoutJE;;8765 AF
ENCODING=QUOTED-PRINTABLE:Straat 34
URL;HOME:www.biss.nu
URL;WORK:www.biss.nu
EMAIL;PREF;INTERNET:Jan@home.nl
END:VCARD



我想用我的应用程序打开Textfile.vcf.当我打开此文件时,我只想显示该文件中用户的信息.表示之前的事情:@每行..

有人可以帮我吗?
谢谢!



I want to open a Textfile.vcf with my app.. when I open this file I want to show only the informatie of the user in this file.. how can i show the information without the things to get the info..ehm i mean the things before : @ each line..

can anyone help me with that?
thanks!

推荐答案

您必须阅读文件并 parse 其行,以便提取有意义的信息(给您看).在Regex类文档 [
You have to read the file and parse its lines in order to extract meaningful (to you) info (have a look at Regex class documentation[^]).


如果要替换:之前的每一行的内容,则可以使用以下代码
If you mean to replace the content of each line before : then the following code can be used
Dim infos As String() = System.IO.File.ReadAllLines("TextFile.vcf")
Dim modifiedInfos As String() = infos.[Select](Function(ln) _
        If(ln.Contains(":"C), ln.Substring(ln.IndexOf(":"C) + 1), ln)).ToArray()
System.IO.File.WriteAllLines("modTextFile.vcf", modifiedInfos)

'Output for the info given in the question
'VCard
'2.1
''T GROENE HART
'
'0505420369
'0505420369
'06-12345678
'06-12345678
'0512 342040
'0512 342040
'0512 342040
';;Straat 34;HoutJE;;8765 AF
'Straat 34
'www.biss.nu
'www.biss.nu
'Jan@home.nl
'VCARD


这篇关于将文本文件中的一部分放入文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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