本文介绍了如何解析包含邮政地址的字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在c#中解析字符串?
假设将给定一个字符串中的地址,我们需要从字符串中解析该地址并返回结构化地址.
输出应在包含所有已解析地址的文本文件中,其中每个已解析的输出地址均采用以下格式:
Street | Locality | City | State | PostalCode | Country
How is a string parsed in c#?
Suppose we will be given an address in a string, we need to parse the address from the string and return the structured address.
The output should be in a text file containing all the parsed addresses, where each parsed output address is in the following format:
Street|Locality|City|State|PostalCode|Country
推荐答案
txtAddress.Text = "Street|Locality|City|State|PostalCode|Country";
string[] sAddressDetails = txtAddress.Text.Split('|');
System.IO.File.WriteAllText("C://PipedText.TXT", txtAddress.Text);
string _sA = "A", _sB = "B", _sC = "C";
System.IO.File.WriteAllText("C://ConcatenatedText.TXT", _sA + "|" + _sB + "|" + _sC);
这篇关于如何解析包含邮政地址的字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!